Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from pathlib import Path
|
2 |
import json
|
|
|
3 |
|
4 |
import gradio as gr
|
5 |
from huggingface_hub import snapshot_download
|
@@ -71,22 +72,27 @@ def submit_eval(model_name, model_tags, web_url, hf_url, code_url, paper_url, in
|
|
71 |
"inference_details": inference_details,
|
72 |
"status": "pending",
|
73 |
}
|
74 |
-
|
75 |
-
json
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
90 |
return "Model submitted successfully π"
|
91 |
|
92 |
|
|
|
1 |
from pathlib import Path
|
2 |
import json
|
3 |
+
import os
|
4 |
|
5 |
import gradio as gr
|
6 |
from huggingface_hub import snapshot_download
|
|
|
72 |
"inference_details": inference_details,
|
73 |
"status": "pending",
|
74 |
}
|
75 |
+
try:
|
76 |
+
with open(f"{EVAL_REQUESTS_PATH}/{model_id}.json", "w") as f:
|
77 |
+
json.dump(request_obj, f)
|
78 |
+
API.upload_file(
|
79 |
+
path_or_fileobj=f"{EVAL_REQUESTS_PATH}/{model_id}.json",
|
80 |
+
path_in_repo=f"{model_id}.json",
|
81 |
+
repo_id=QUEUE_REPO,
|
82 |
+
repo_type="dataset",
|
83 |
+
commit_message=f"Add {model_name} to evaluation queue",
|
84 |
+
)
|
85 |
+
API.upload_file(
|
86 |
+
path_or_fileobj=f"{EVAL_REQUESTS_PATH}/{model_id}.tar.gz",
|
87 |
+
path_in_repo=f"{model_id}.tar.gz",
|
88 |
+
repo_id=QUEUE_REPO,
|
89 |
+
repo_type="dataset",
|
90 |
+
commit_message=f"Add {model_name} to evaluation queue",
|
91 |
+
)
|
92 |
+
except error:
|
93 |
+
os.remove(f"{EVAL_REQUESTS_PATH}/{model_id}.json")
|
94 |
+
return f"Error: {error}"
|
95 |
+
|
96 |
return "Model submitted successfully π"
|
97 |
|
98 |
|