tohid.abedini
commited on
Commit
·
09205b6
1
Parent(s):
586a1e6
[Add] about
Browse files
utils.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import json
|
2 |
import os
|
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import pandas as pd
|
@@ -219,9 +220,14 @@ def submit(model_name, model_id, contact_email, section, license):
|
|
219 |
"contact_email": contact_email,
|
220 |
"license": license
|
221 |
}
|
|
|
|
|
|
|
222 |
OUT_DIR = f"{EVAL_REQUESTS_PATH}/{user_name}"
|
223 |
os.makedirs(OUT_DIR, exist_ok=True)
|
224 |
-
|
|
|
|
|
225 |
|
226 |
with open(out_path, "w") as f:
|
227 |
f.write(json.dumps(eval_entry))
|
@@ -238,5 +244,5 @@ def submit(model_name, model_id, contact_email, section, license):
|
|
238 |
gr.Info("Successfully submitted", duration=10)
|
239 |
# Remove the local file
|
240 |
os.remove(out_path)
|
241 |
-
except:
|
242 |
-
gr.Error("Error submitting the model")
|
|
|
1 |
import json
|
2 |
import os
|
3 |
+
from datetime import datetime
|
4 |
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
|
|
220 |
"contact_email": contact_email,
|
221 |
"license": license
|
222 |
}
|
223 |
+
|
224 |
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
225 |
+
|
226 |
OUT_DIR = f"{EVAL_REQUESTS_PATH}/{user_name}"
|
227 |
os.makedirs(OUT_DIR, exist_ok=True)
|
228 |
+
|
229 |
+
# Add the timestamp to the filename
|
230 |
+
out_path = f"{OUT_DIR}/{user_name}_{model_path}_{timestamp}.json"
|
231 |
|
232 |
with open(out_path, "w") as f:
|
233 |
f.write(json.dumps(eval_entry))
|
|
|
244 |
gr.Info("Successfully submitted", duration=10)
|
245 |
# Remove the local file
|
246 |
os.remove(out_path)
|
247 |
+
except Exception as e:
|
248 |
+
gr.Error(f"Error submitting the model: {e}")
|