Spaces:
Runtime error
Runtime error
osanseviero
commited on
Commit
•
0dcf350
1
Parent(s):
b99b7f1
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ def fork(source_repo, dst_repo, token, repo_type):
|
|
15 |
if repo_type in ["space", "dataset"]:
|
16 |
# For some reason create_repo does not allow repo_type="model"..., even if documentation says
|
17 |
# that's the default.
|
18 |
-
create_repo(dst_id, token=token, organization=org, repo_type=repo_type, space_sdk="
|
19 |
else:
|
20 |
create_repo(dst_id, token=token, organization=org)
|
21 |
|
@@ -36,7 +36,8 @@ def fork(source_repo, dst_repo, token, repo_type):
|
|
36 |
command = f"git remote set-url origin https://user:{token}@huggingface.co/"
|
37 |
if repo_type in ["space", "dataset"]:
|
38 |
# Can we not have to add the s here? Why do we use singular and plural inconsistently?
|
39 |
-
command += repo_type +
|
|
|
40 |
command += dst_repo
|
41 |
subprocess.run(
|
42 |
command.split(),
|
@@ -57,14 +58,13 @@ def fork(source_repo, dst_repo, token, repo_type):
|
|
57 |
cwd=local_dir,
|
58 |
)
|
59 |
|
60 |
-
# Clean up
|
61 |
for filename in os.listdir(local_dir):
|
62 |
file_path = os.path.join(local_dir, filename)
|
63 |
if os.path.isfile(file_path) or os.path.islink(file_path):
|
64 |
os.unlink(file_path)
|
65 |
elif os.path.isdir(file_path):
|
66 |
shutil.rmtree(file_path)
|
67 |
-
|
68 |
return endpoint + "/" + dst_repo
|
69 |
|
70 |
interface = gr.Interface(
|
@@ -76,6 +76,7 @@ interface = gr.Interface(
|
|
76 |
gr.inputs.Dropdown(choices=["model", "dataset", "space"])
|
77 |
],
|
78 |
outputs=["textbox"],
|
|
|
79 |
allow_flagging=False,
|
80 |
live=False,
|
81 |
)
|
|
|
15 |
if repo_type in ["space", "dataset"]:
|
16 |
# For some reason create_repo does not allow repo_type="model"..., even if documentation says
|
17 |
# that's the default.
|
18 |
+
create_repo(dst_id, token=token, organization=org, repo_type=repo_type, space_sdk="gradio")
|
19 |
else:
|
20 |
create_repo(dst_id, token=token, organization=org)
|
21 |
|
|
|
36 |
command = f"git remote set-url origin https://user:{token}@huggingface.co/"
|
37 |
if repo_type in ["space", "dataset"]:
|
38 |
# Can we not have to add the s here? Why do we use singular and plural inconsistently?
|
39 |
+
command += repo_type +"s/"
|
40 |
+
|
41 |
command += dst_repo
|
42 |
subprocess.run(
|
43 |
command.split(),
|
|
|
58 |
cwd=local_dir,
|
59 |
)
|
60 |
|
61 |
+
# Clean up to be nice with the environment
|
62 |
for filename in os.listdir(local_dir):
|
63 |
file_path = os.path.join(local_dir, filename)
|
64 |
if os.path.isfile(file_path) or os.path.islink(file_path):
|
65 |
os.unlink(file_path)
|
66 |
elif os.path.isdir(file_path):
|
67 |
shutil.rmtree(file_path)
|
|
|
68 |
return endpoint + "/" + dst_repo
|
69 |
|
70 |
interface = gr.Interface(
|
|
|
76 |
gr.inputs.Dropdown(choices=["model", "dataset", "space"])
|
77 |
],
|
78 |
outputs=["textbox"],
|
79 |
+
description="Find your write token at https://huggingface.co/settings/token",
|
80 |
allow_flagging=False,
|
81 |
live=False,
|
82 |
)
|