osanseviero commited on
Commit
96042a5
·
1 Parent(s): 117e709

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -3,10 +3,7 @@ import requests
3
  from huggingface_hub import whoami
4
  from huggingface_hub.utils import build_hf_headers, hf_raise_for_status
5
 
6
- ENDPOINT = "https://huggingface.co"
7
- # ENDPOINT = "http://localhost:5564"
8
-
9
- REPO_TYPES = ["model", "dataset", "space"]
10
 
11
 
12
  def duplicate(source_repo, dst_repo, token, repo_type):
@@ -17,7 +14,7 @@ def duplicate(source_repo, dst_repo, token, repo_type):
17
  # ^ this will throw if token is invalid
18
 
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
  )
@@ -44,17 +41,16 @@ def duplicate(source_repo, dst_repo, token, repo_type):
44
  interface = gr.Interface(
45
  fn=duplicate,
46
  inputs=[
47
- gr.Textbox(placeholder="Source repository (e.g. osanseviero/src)"),
48
- gr.Textbox(placeholder="Destination repository (e.g. osanseviero/dst)"),
49
  gr.Textbox(placeholder="Write access token"),
50
- gr.Dropdown(choices=REPO_TYPES, value="model"),
51
  ],
52
  outputs=[
53
  gr.Markdown(label="output"),
54
  gr.Image(show_label=False),
55
  ],
56
- title="Duplicate your repo!",
57
- description="Duplicate a Hugging Face repository! You need to specify a write token obtained in https://hf.co/settings/tokens. This Space is a an experimental demo.",
58
  article="<p>Find your write token at <a href='https://huggingface.co/settings/tokens' target='_blank'>token settings</a></p>",
59
  allow_flagging="never",
60
  live=False,
 
3
  from huggingface_hub import whoami
4
  from huggingface_hub.utils import build_hf_headers, hf_raise_for_status
5
 
6
+ ENDPOINT = ""
 
 
 
7
 
8
 
9
  def duplicate(source_repo, dst_repo, token, repo_type):
 
14
  # ^ this will throw if token is invalid
15
 
16
  r = requests.post(
17
+ "https://huggingface.co/api/spaces/whisper-event/whisper-demo/duplicate",
18
  headers=build_hf_headers(token=token),
19
  json={"repository": dst_repo},
20
  )
 
41
  interface = gr.Interface(
42
  fn=duplicate,
43
  inputs=[
44
+ gr.Textbox(placeholder="Destination repository (e.g. username/dst_repo_name)"),
45
+ gr.Textbox(placeholder="Model id (e.g. openai/whisper-small)"),
46
  gr.Textbox(placeholder="Write access token"),
 
47
  ],
48
  outputs=[
49
  gr.Markdown(label="output"),
50
  gr.Image(show_label=False),
51
  ],
52
+ title="Build your Whisper demo!",
53
+ description="Build your Whisper demo! You need to specify a write token obtained in https://hf.co/settings/tokens.",
54
  article="<p>Find your write token at <a href='https://huggingface.co/settings/tokens' target='_blank'>token settings</a></p>",
55
  allow_flagging="never",
56
  live=False,