osanseviero commited on
Commit
16848a3
·
1 Parent(s): 2058f6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import requests
3
- from huggingface_hub import whoami, hf_hub_download
4
  from huggingface_hub.utils import build_hf_headers, hf_raise_for_status
5
 
6
  app_script = hf_hub_download(repo_id="whisper-event/whisper-demo", filename="app.py", repo_type="space")
@@ -29,6 +29,12 @@ def duplicate(destination_repo, model_id, token):
29
 
30
  app_script = hf_hub_download(repo_id="whisper-event/whisper-demo", filename="app.py", repo_type="space")
31
  replace_line(app_script, 7, f"MODEL_NAME = \"{model_id}\"\n")
 
 
 
 
 
 
32
 
33
  return (
34
  f'Find your repo <a href=\'{repo_url}\' target="_blank" style="text-decoration:underline">here</a>',
 
1
  import gradio as gr
2
  import requests
3
+ from huggingface_hub import whoami, hf_hub_download, upload_file
4
  from huggingface_hub.utils import build_hf_headers, hf_raise_for_status
5
 
6
  app_script = hf_hub_download(repo_id="whisper-event/whisper-demo", filename="app.py", repo_type="space")
 
29
 
30
  app_script = hf_hub_download(repo_id="whisper-event/whisper-demo", filename="app.py", repo_type="space")
31
  replace_line(app_script, 7, f"MODEL_NAME = \"{model_id}\"\n")
32
+ upload_file(
33
+ path_or_fileobj=app_script,
34
+ path_in_repo="app.py",
35
+ repo_id=destination_repo,
36
+ repo_type="space",
37
+ )
38
 
39
  return (
40
  f'Find your repo <a href=\'{repo_url}\' target="_blank" style="text-decoration:underline">here</a>',