Spaces:
Sleeping
Sleeping
Commit
•
a1d6c04
1
Parent(s):
a7a0881
Add option to make the destination repo private (#9)
Browse files- Add option to make the destination repo private (80cafae712d720e07f274619f0f86686164333d2)
Co-authored-by: Bartowski <[email protected]>
app.py
CHANGED
@@ -9,7 +9,7 @@ ENDPOINT = "https://huggingface.co"
|
|
9 |
REPO_TYPES = ["model", "dataset", "space"]
|
10 |
|
11 |
|
12 |
-
def duplicate(source_repo, dst_repo, token, repo_type):
|
13 |
try:
|
14 |
if not repo_type in REPO_TYPES:
|
15 |
raise ValueError("need to select valid repo type")
|
@@ -19,7 +19,7 @@ def duplicate(source_repo, dst_repo, token, repo_type):
|
|
19 |
r = requests.post(
|
20 |
f"{ENDPOINT}/api/{repo_type}s/{source_repo}/duplicate",
|
21 |
headers=build_hf_headers(token=token),
|
22 |
-
json={"repository": dst_repo},
|
23 |
)
|
24 |
hf_raise_for_status(r)
|
25 |
|
@@ -48,6 +48,7 @@ interface = gr.Interface(
|
|
48 |
gr.Textbox(placeholder="Destination repository (e.g. osanseviero/dst)"),
|
49 |
gr.Textbox(placeholder="Write access token", type="password"),
|
50 |
gr.Dropdown(choices=REPO_TYPES, value="model"),
|
|
|
51 |
],
|
52 |
outputs=[
|
53 |
gr.Markdown(label="output"),
|
|
|
9 |
REPO_TYPES = ["model", "dataset", "space"]
|
10 |
|
11 |
|
12 |
+
def duplicate(source_repo, dst_repo, token, repo_type, private):
|
13 |
try:
|
14 |
if not repo_type in REPO_TYPES:
|
15 |
raise ValueError("need to select valid repo type")
|
|
|
19 |
r = requests.post(
|
20 |
f"{ENDPOINT}/api/{repo_type}s/{source_repo}/duplicate",
|
21 |
headers=build_hf_headers(token=token),
|
22 |
+
json={"repository": dst_repo, "private": private},
|
23 |
)
|
24 |
hf_raise_for_status(r)
|
25 |
|
|
|
48 |
gr.Textbox(placeholder="Destination repository (e.g. osanseviero/dst)"),
|
49 |
gr.Textbox(placeholder="Write access token", type="password"),
|
50 |
gr.Dropdown(choices=REPO_TYPES, value="model"),
|
51 |
+
gr.Checkbox(label="Make new repo private?"),
|
52 |
],
|
53 |
outputs=[
|
54 |
gr.Markdown(label="output"),
|