multimodalart HF Staff commited on
Commit
12451eb
·
verified ·
1 Parent(s): c68432f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from huggingface_hub import HfApi
3
  from git import Repo
4
  import uuid
5
-
6
 
7
  def clone(profile: gr.OAuthProfile, oauth_token: gr.OAuthToken, repo_git, repo_hf):
8
  folder = uuid.uuid1()
@@ -11,10 +11,10 @@ def clone(profile: gr.OAuthProfile, oauth_token: gr.OAuthToken, repo_git, repo_h
11
  api = HfApi(token=oauth_token)
12
  api.upload_folder(
13
  folder_path=cloned_repo,
14
- repo_id={profile.username}/{repo_hf},
15
  repo_type="space",
16
  )
17
- return f"https://huggingface.co/{profile.username}/{repo_hf}"
18
 
19
 
20
  with gr.Blocks() as demo:
 
2
  from huggingface_hub import HfApi
3
  from git import Repo
4
  import uuid
5
+ from slugify import slugify
6
 
7
  def clone(profile: gr.OAuthProfile, oauth_token: gr.OAuthToken, repo_git, repo_hf):
8
  folder = uuid.uuid1()
 
11
  api = HfApi(token=oauth_token)
12
  api.upload_folder(
13
  folder_path=cloned_repo,
14
+ repo_id={profile.username}/{slugify(repo_hf)},
15
  repo_type="space",
16
  )
17
+ return f"https://huggingface.co/{profile.username}/{slugify(repo_hf)}"
18
 
19
 
20
  with gr.Blocks() as demo: