fffiloni commited on
Commit
9911949
1 Parent(s): 62db9b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -3,6 +3,7 @@ import tempfile
3
  import os
4
  from git import Repo
5
  from huggingface_hub import HfApi, create_repo, upload_folder
 
6
  api = HfApi()
7
 
8
 
@@ -25,14 +26,19 @@ def process(git_repo_url, space_destination, user_token):
25
  for f in files:
26
  print(f"{sub_indent}{f}")
27
 
28
- api.upload_folder(
29
- folder_path=tmp_dir,
30
- repo_id=space_destination,
31
- repo_type="space",
32
- token=user_token
33
- )
 
 
 
 
 
34
 
35
- return "Done"
36
 
37
  css = """
38
  div#col-container{
 
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
 
 
26
  for f in files:
27
  print(f"{sub_indent}{f}")
28
 
29
+ try:
30
+ api.upload_folder(
31
+ folder_path=tmp_dir,
32
+ repo_id=space_destination,
33
+ repo_type="space",
34
+ token=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{