fffiloni commited on
Commit
7d4e20d
·
verified ·
1 Parent(s): 9911949

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -2,8 +2,7 @@ import gradio as gr
2
  import tempfile
3
  import os
4
  from git import Repo
5
- from huggingface_hub import HfApi, create_repo, upload_folder
6
- from huggingface_hub import RepositoryNotFoundError
7
  api = HfApi()
8
 
9
 
@@ -35,10 +34,13 @@ def process(git_repo_url, space_destination, user_token):
35
  )
36
  return "Done"
37
 
38
- except RepositoryNotFoundError as e:
39
- print("HELLO Error !!!")
40
-
41
- return e
 
 
 
42
 
43
  css = """
44
  div#col-container{
 
2
  import tempfile
3
  import os
4
  from git import Repo
5
+ from huggingface_hub import HfApi, create_repo, upload_folder, HfHubHTTPError
 
6
  api = HfApi()
7
 
8
 
 
34
  )
35
  return "Done"
36
 
37
+ except HfHubHTTPError as e:
38
+ # Check if the error is a "Repository Not Found" error
39
+ if "401 Client Error" in str(e) and "Repository Not Found" in str(e):
40
+ print("Repository not found. Creating the repository...")
41
+ else:
42
+ # Re-raise the exception if it's not a "Repository Not Found" error
43
+ raise e
44
 
45
  css = """
46
  div#col-container{