Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,10 +10,12 @@ ENDPOINT = "https://huggingface.co"
|
|
10 |
REPO_TYPES = ["model", "dataset", "space"]
|
11 |
|
12 |
|
13 |
-
def duplicate(source_repo, dst_repo,
|
14 |
try:
|
15 |
if not repo_type in REPO_TYPES:
|
16 |
raise ValueError("need to select valid repo type")
|
|
|
|
|
17 |
_ = whoami(token)
|
18 |
# ^ this will throw if token is invalid
|
19 |
|
@@ -45,6 +47,7 @@ def duplicate(source_repo, dst_repo, token, repo_type, private):
|
|
45 |
interface = gr.Interface(
|
46 |
fn=duplicate,
|
47 |
inputs=[
|
|
|
48 |
HuggingfaceHubSearch(
|
49 |
placeholder="Source repository (e.g. osanseviero/src)",
|
50 |
search_type=["model", "dataset", "space"],
|
|
|
10 |
REPO_TYPES = ["model", "dataset", "space"]
|
11 |
|
12 |
|
13 |
+
def duplicate(source_repo, dst_repo, repo_type, private,oauth_token: gr.OAuthToken | None):
|
14 |
try:
|
15 |
if not repo_type in REPO_TYPES:
|
16 |
raise ValueError("need to select valid repo type")
|
17 |
+
|
18 |
+
token = oauth_token.token
|
19 |
_ = whoami(token)
|
20 |
# ^ this will throw if token is invalid
|
21 |
|
|
|
47 |
interface = gr.Interface(
|
48 |
fn=duplicate,
|
49 |
inputs=[
|
50 |
+
gr.LoginButton(),
|
51 |
HuggingfaceHubSearch(
|
52 |
placeholder="Source repository (e.g. osanseviero/src)",
|
53 |
search_type=["model", "dataset", "space"],
|