Spaces:
Runtime error
Runtime error
Commit
·
b99b7f1
1
Parent(s):
413550a
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ def fork(source_repo, dst_repo, token, repo_type):
|
|
12 |
org = repo_namespace
|
13 |
|
14 |
# Create the destination repo
|
15 |
-
if repo_type in ["
|
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="static")
|
@@ -21,12 +21,12 @@ def fork(source_repo, dst_repo, token, repo_type):
|
|
21 |
|
22 |
# Clone source repo
|
23 |
endpoint = "https://huggingface.co/"
|
24 |
-
if repo_type in ["
|
25 |
endpoint += repo_type
|
26 |
full_path = endpoint + "/" + source_repo
|
27 |
local_dir = "hub/" + source_repo
|
28 |
|
29 |
-
if repo_type in ["
|
30 |
# Same as above
|
31 |
repo = Repository(local_dir=local_dir, clone_from=full_path, repo_type=repo_type)
|
32 |
else:
|
@@ -34,8 +34,9 @@ def fork(source_repo, dst_repo, token, repo_type):
|
|
34 |
|
35 |
# Change remote origin
|
36 |
command = f"git remote set-url origin https://user:{token}@huggingface.co/"
|
37 |
-
if repo_type in ["
|
38 |
-
|
|
|
39 |
command += dst_repo
|
40 |
subprocess.run(
|
41 |
command.split(),
|
@@ -72,7 +73,7 @@ interface = gr.Interface(
|
|
72 |
gr.inputs.Textbox(placeholder="Source repository (e.g. osanseviero/src)"),
|
73 |
gr.inputs.Textbox(placeholder="Destination repository (e.g. osanseviero/dst)"),
|
74 |
gr.inputs.Textbox(placeholder="Write access token"),
|
75 |
-
gr.inputs.Dropdown(choices=["model", "dataset", "
|
76 |
],
|
77 |
outputs=["textbox"],
|
78 |
allow_flagging=False,
|
|
|
12 |
org = repo_namespace
|
13 |
|
14 |
# Create the destination repo
|
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="static")
|
|
|
21 |
|
22 |
# Clone source repo
|
23 |
endpoint = "https://huggingface.co/"
|
24 |
+
if repo_type in ["space", "dataset"]:
|
25 |
endpoint += repo_type
|
26 |
full_path = endpoint + "/" + source_repo
|
27 |
local_dir = "hub/" + source_repo
|
28 |
|
29 |
+
if repo_type in ["space", "dataset"]:
|
30 |
# Same as above
|
31 |
repo = Repository(local_dir=local_dir, clone_from=full_path, repo_type=repo_type)
|
32 |
else:
|
|
|
34 |
|
35 |
# Change remote origin
|
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 |
command += dst_repo
|
41 |
subprocess.run(
|
42 |
command.split(),
|
|
|
73 |
gr.inputs.Textbox(placeholder="Source repository (e.g. osanseviero/src)"),
|
74 |
gr.inputs.Textbox(placeholder="Destination repository (e.g. osanseviero/dst)"),
|
75 |
gr.inputs.Textbox(placeholder="Write access token"),
|
76 |
+
gr.inputs.Dropdown(choices=["model", "dataset", "space"])
|
77 |
],
|
78 |
outputs=["textbox"],
|
79 |
allow_flagging=False,
|