Spaces:
Sleeping
Sleeping
last one cause infinite loop idk
Browse files
app.py
CHANGED
|
@@ -120,7 +120,7 @@ def evaluate_model(username, file):
|
|
| 120 |
|
| 121 |
username = username.strip()
|
| 122 |
if not username:
|
| 123 |
-
return
|
| 124 |
|
| 125 |
script_path = f"submissions/{username}.py"
|
| 126 |
os.makedirs("submissions", exist_ok=True)
|
|
@@ -163,9 +163,7 @@ def evaluate_model(username, file):
|
|
| 163 |
status, sectors_model = import_and_run_function(file, "eval", filename)
|
| 164 |
print(status)
|
| 165 |
print(f"TYPE: {type(sectors_model), {type(sectors_model[0])}}")
|
| 166 |
-
|
| 167 |
-
if "Error" in status:
|
| 168 |
-
return f"Model Error: {status}", leaderboard_data.values.tolist()
|
| 169 |
|
| 170 |
print("SECTORS MODEL: ", sectors_model)
|
| 171 |
# sectors_model = eval(filename)
|
|
@@ -190,7 +188,7 @@ def evaluate_model(username, file):
|
|
| 190 |
except Exception as e:
|
| 191 |
leaderboard_data = pd.concat([leaderboard_data, pd.DataFrame([[username, float("inf"), 0,-1,-1,-1,-1, f"Model Error: {str(e)}"]],
|
| 192 |
columns=HEADERS)], ignore_index=True)
|
| 193 |
-
return
|
| 194 |
print("calculating new entry")
|
| 195 |
|
| 196 |
new_entry = pd.DataFrame([[username, execution_time, accuracy, TP, FP, FN, TN, status]],
|
|
@@ -202,7 +200,7 @@ def evaluate_model(username, file):
|
|
| 202 |
leaderboard_data = leaderboard_data.sort_values(by=["Accuracy", "Execution Time (s)"],
|
| 203 |
ascending=[False, True]).reset_index(drop=True)
|
| 204 |
|
| 205 |
-
return
|
| 206 |
|
| 207 |
def import_and_run_function(script_path, function_name, filename):
|
| 208 |
|
|
|
|
| 120 |
|
| 121 |
username = username.strip()
|
| 122 |
if not username:
|
| 123 |
+
return leaderboard_data.values.tolist()
|
| 124 |
|
| 125 |
script_path = f"submissions/{username}.py"
|
| 126 |
os.makedirs("submissions", exist_ok=True)
|
|
|
|
| 163 |
status, sectors_model = import_and_run_function(file, "eval", filename)
|
| 164 |
print(status)
|
| 165 |
print(f"TYPE: {type(sectors_model), {type(sectors_model[0])}}")
|
| 166 |
+
|
|
|
|
|
|
|
| 167 |
|
| 168 |
print("SECTORS MODEL: ", sectors_model)
|
| 169 |
# sectors_model = eval(filename)
|
|
|
|
| 188 |
except Exception as e:
|
| 189 |
leaderboard_data = pd.concat([leaderboard_data, pd.DataFrame([[username, float("inf"), 0,-1,-1,-1,-1, f"Model Error: {str(e)}"]],
|
| 190 |
columns=HEADERS)], ignore_index=True)
|
| 191 |
+
return leaderboard_data.values.tolist()
|
| 192 |
print("calculating new entry")
|
| 193 |
|
| 194 |
new_entry = pd.DataFrame([[username, execution_time, accuracy, TP, FP, FN, TN, status]],
|
|
|
|
| 200 |
leaderboard_data = leaderboard_data.sort_values(by=["Accuracy", "Execution Time (s)"],
|
| 201 |
ascending=[False, True]).reset_index(drop=True)
|
| 202 |
|
| 203 |
+
return leaderboard_data.values.tolist()
|
| 204 |
|
| 205 |
def import_and_run_function(script_path, function_name, filename):
|
| 206 |
|