Update app.py
Browse files
app.py
CHANGED
@@ -31,18 +31,21 @@ def run(token: str, model_id: str) -> str:
|
|
31 |
commit_info = convert(api=api, model_id=model_id)
|
32 |
|
33 |
# save in a private dataset:
|
34 |
-
repo
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
46 |
|
47 |
return f"""
|
48 |
### Success 🔥
|
|
|
31 |
commit_info = convert(api=api, model_id=model_id)
|
32 |
|
33 |
# save in a private dataset:
|
34 |
+
if repo is not None:
|
35 |
+
repo.git_pull(rebase=True)
|
36 |
+
with open(DATA_FILE, "a") as csvfile:
|
37 |
+
writer = csv.DictWriter(
|
38 |
+
csvfile, fieldnames=["model_id", "pr_url", "time"]
|
39 |
+
)
|
40 |
+
writer.writerow(
|
41 |
+
{
|
42 |
+
"model_id": model_id,
|
43 |
+
"pr_url": commit_info.pr_url,
|
44 |
+
"time": str(datetime.now()),
|
45 |
+
}
|
46 |
+
)
|
47 |
+
commit_url = repo.push_to_hub()
|
48 |
+
print("[dataset]", commit_url)
|
49 |
|
50 |
return f"""
|
51 |
### Success 🔥
|