Update init.py
Browse files
init.py
CHANGED
@@ -69,7 +69,7 @@ def load_multilingual_data():
|
|
69 |
repo_type="dataset",
|
70 |
)
|
71 |
multilingual_repo.git_pull()
|
72 |
-
multilingual_csv =
|
73 |
except Exception as e:
|
74 |
print(f"Failed to pull from multilingual repo: {e}")
|
75 |
multilingual_csv = None
|
@@ -79,7 +79,7 @@ def load_multilingual_data():
|
|
79 |
# Fallback to local file
|
80 |
if multilingual_csv is None:
|
81 |
print("Using local multilingual CSV file.")
|
82 |
-
multilingual_csv =
|
83 |
|
84 |
return multilingual_csv
|
85 |
except Exception as e:
|
@@ -102,7 +102,7 @@ def load_longform_data():
|
|
102 |
repo_type="dataset",
|
103 |
)
|
104 |
longform_repo.git_pull()
|
105 |
-
longform_csv =
|
106 |
except Exception as e:
|
107 |
print(f"Failed to pull from longform repo: {e}")
|
108 |
longform_csv = None
|
@@ -112,7 +112,7 @@ def load_longform_data():
|
|
112 |
# Fallback to local file
|
113 |
if longform_csv is None:
|
114 |
print("Using local longform CSV file.")
|
115 |
-
longform_csv =
|
116 |
|
117 |
return longform_csv
|
118 |
except Exception as e:
|
@@ -144,32 +144,6 @@ def get_csv_with_results(directory):
|
|
144 |
return None
|
145 |
return latest[0]
|
146 |
|
147 |
-
def get_multilingual_csv_with_results(directory):
|
148 |
-
"""Get multilingual CSV results file"""
|
149 |
-
directory = Path(directory)
|
150 |
-
multilingual_csv_files = list(directory.glob("multilingual_results_latest.csv"))
|
151 |
-
if len(multilingual_csv_files) != 1:
|
152 |
-
# Try local directory as fallback
|
153 |
-
local_multilingual = Path("multilingual_results_latest.csv")
|
154 |
-
if local_multilingual.exists():
|
155 |
-
return local_multilingual
|
156 |
-
return None
|
157 |
-
return multilingual_csv_files[0]
|
158 |
-
|
159 |
-
def get_longform_csv_with_results(directory):
|
160 |
-
"""Get longform CSV results file"""
|
161 |
-
directory = Path(directory)
|
162 |
-
longform_csv_files = list(directory.glob("longform_results_latest.csv"))
|
163 |
-
if len(longform_csv_files) != 1:
|
164 |
-
# Try local directory as fallback
|
165 |
-
local_longform = Path("longform_results_latest.csv")
|
166 |
-
if local_longform.exists():
|
167 |
-
return local_longform
|
168 |
-
return None
|
169 |
-
return longform_csv_files[0]
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
def is_model_on_hub(model_name, revision="main") -> bool:
|
174 |
try:
|
175 |
model_name = model_name.replace(" ","")
|
|
|
69 |
repo_type="dataset",
|
70 |
)
|
71 |
multilingual_repo.git_pull()
|
72 |
+
multilingual_csv = get_csv_with_results(multilingual_queue_path)
|
73 |
except Exception as e:
|
74 |
print(f"Failed to pull from multilingual repo: {e}")
|
75 |
multilingual_csv = None
|
|
|
79 |
# Fallback to local file
|
80 |
if multilingual_csv is None:
|
81 |
print("Using local multilingual CSV file.")
|
82 |
+
multilingual_csv = get_csv_with_results(".")
|
83 |
|
84 |
return multilingual_csv
|
85 |
except Exception as e:
|
|
|
102 |
repo_type="dataset",
|
103 |
)
|
104 |
longform_repo.git_pull()
|
105 |
+
longform_csv = get_csv_with_results(longform_queue_path)
|
106 |
except Exception as e:
|
107 |
print(f"Failed to pull from longform repo: {e}")
|
108 |
longform_csv = None
|
|
|
112 |
# Fallback to local file
|
113 |
if longform_csv is None:
|
114 |
print("Using local longform CSV file.")
|
115 |
+
longform_csv = get_csv_with_results(".")
|
116 |
|
117 |
return longform_csv
|
118 |
except Exception as e:
|
|
|
144 |
return None
|
145 |
return latest[0]
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
def is_model_on_hub(model_name, revision="main") -> bool:
|
148 |
try:
|
149 |
model_name = model_name.replace(" ","")
|