Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Felix Marty
commited on
Commit
ยท
fc102c7
1
Parent(s):
171b6b3
fix logging
Browse files
app.py
CHANGED
@@ -12,18 +12,20 @@ DATASET_REPO_URL = "https://huggingface.co/datasets/optimum/exporters"
|
|
12 |
DATA_FILENAME = "data.csv"
|
13 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
14 |
|
15 |
-
HF_TOKEN = os.environ.get("
|
|
|
|
|
16 |
|
17 |
repo: Optional[Repository] = None
|
18 |
if HF_TOKEN:
|
19 |
-
repo = Repository(local_dir=
|
20 |
|
21 |
def onnx_export(token: str, model_id: str, task: str) -> str:
|
22 |
if token == "" or model_id == "":
|
23 |
return """
|
24 |
### Invalid input ๐
|
25 |
|
26 |
-
Please fill a token and
|
27 |
"""
|
28 |
try:
|
29 |
api = HfApi(token=token)
|
@@ -37,7 +39,7 @@ def onnx_export(token: str, model_id: str, task: str) -> str:
|
|
37 |
# save in a private dataset
|
38 |
if repo is not None:
|
39 |
repo.git_pull(rebase=True)
|
40 |
-
with open(DATA_FILE, "a") as csvfile:
|
41 |
writer = csv.DictWriter(
|
42 |
csvfile, fieldnames=["model_id", "pr_url", "time"]
|
43 |
)
|
|
|
12 |
DATA_FILENAME = "data.csv"
|
13 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
14 |
|
15 |
+
HF_TOKEN = os.environ.get("HF_PRIVATE_TOKEN")
|
16 |
+
|
17 |
+
DATADIR = "exporters_data"
|
18 |
|
19 |
repo: Optional[Repository] = None
|
20 |
if HF_TOKEN:
|
21 |
+
repo = Repository(local_dir=DATADIR, clone_from=DATASET_REPO_URL, token=HF_TOKEN)
|
22 |
|
23 |
def onnx_export(token: str, model_id: str, task: str) -> str:
|
24 |
if token == "" or model_id == "":
|
25 |
return """
|
26 |
### Invalid input ๐
|
27 |
|
28 |
+
Please fill a token and model name.
|
29 |
"""
|
30 |
try:
|
31 |
api = HfApi(token=token)
|
|
|
39 |
# save in a private dataset
|
40 |
if repo is not None:
|
41 |
repo.git_pull(rebase=True)
|
42 |
+
with open(os.path.join(DATADIR, DATA_FILE), "a") as csvfile:
|
43 |
writer = csv.DictWriter(
|
44 |
csvfile, fieldnames=["model_id", "pr_url", "time"]
|
45 |
)
|