multimodalart HF staff commited on
Commit
9329734
1 Parent(s): 59ba410

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -20
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import requests
2
  import os
3
  import gradio as gr
4
- from huggingface_hub import update_repo_visibility, whoami, upload_folder, create_repo, upload_file
5
  from slugify import slugify
6
  import gradio as gr
7
  import re
@@ -314,26 +314,15 @@ def upload_civit_to_hf(profile: Optional[gr.OAuthProfile], oauth_token: gr.OAuth
314
  print(user_repo_id)
315
  create_repo(repo_id=user_repo_id, private=False, exist_ok=True, token=oauth_token.token)
316
  print("Uploading repo...")
317
- for filename in os.listdir(folder):
318
- file_path = os.path.join(folder, filename)
319
- print(filename)
320
- print("size: ", os.path.getsize(file_path))
321
- print(oauth_token.token)
322
- upload_file(
323
- path_or_fileobj=file_path,
324
- path_in_repo=filename,
325
- repo_id=user_repo_id,
326
- repo_type="model",
327
- token=oauth_token.token
328
- )
329
- # upload_folder(
330
- # folder_path=folder,
331
- # repo_id=user_repo_id,
332
- # repo_type="model",
333
- # token=oauth_token.token
334
- # )
335
 
336
- #api.update_repo_visibility(repo_id=user_repo_id, private=False)
 
 
 
 
 
 
 
337
  except:
338
  raise gr.Error("uploading the repo went wrong")
339
 
 
1
  import requests
2
  import os
3
  import gradio as gr
4
+ from huggingface_hub import update_repo_visibility, whoami, upload_folder, create_repo, upload_file, update_repo_visibility
5
  from slugify import slugify
6
  import gradio as gr
7
  import re
 
314
  print(user_repo_id)
315
  create_repo(repo_id=user_repo_id, private=False, exist_ok=True, token=oauth_token.token)
316
  print("Uploading repo...")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
 
318
+ upload_folder(
319
+ folder_path=folder,
320
+ repo_id=user_repo_id,
321
+ repo_type="model",
322
+ token=oauth_token.token
323
+ )
324
+
325
+ update_repo_visibility(repo_id=user_repo_id, private=False)
326
  except:
327
  raise gr.Error("uploading the repo went wrong")
328