multimodalart HF staff commited on
Commit
08324cf
1 Parent(s): a48615d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -337,22 +337,17 @@ def upload_civit_to_hf(profile: Optional[gr.OAuthProfile], oauth_token: gr.OAuth
337
  folder = str(uuid.uuid4())
338
  os.makedirs(folder, exist_ok=False)
339
  info, downloaded_files = process_url(url, profile, folder=folder)
340
- #try:
341
- #print(oauth_token)
342
- #print(oauth_token.token)
343
- #api = HfApi()
344
-
345
- #except:
346
- # raise gr.Error("logging into hf went wrong")
347
  username = {profile.username}
348
  slug_name = slugify(info["name"])
349
  user_repo_id = f"{profile.username}/{slug_name}"
350
  create_readme(info, downloaded_files, user_repo_id, link_civit, folder=folder)
351
  try:
352
- #repo_id = f"{username}/{profile.preferred_username}-{slug_name}"
 
 
353
  print("Creating repo...")
354
  print(user_repo_id)
355
- create_repo(repo_id=user_repo_id, private=False, exist_ok=True, token=oauth_token.token)
356
  print("Uploading repo...")
357
  upload_folder(
358
  folder_path=folder,
@@ -360,7 +355,6 @@ def upload_civit_to_hf(profile: Optional[gr.OAuthProfile], oauth_token: gr.OAuth
360
  repo_type="model",
361
  token=oauth_token.token
362
  )
363
-
364
  update_repo_visibility(repo_id=user_repo_id, private=False, token=oauth_token.token)
365
  except Exception as e:
366
  print(e)
 
337
  folder = str(uuid.uuid4())
338
  os.makedirs(folder, exist_ok=False)
339
  info, downloaded_files = process_url(url, profile, folder=folder)
 
 
 
 
 
 
 
340
  username = {profile.username}
341
  slug_name = slugify(info["name"])
342
  user_repo_id = f"{profile.username}/{slug_name}"
343
  create_readme(info, downloaded_files, user_repo_id, link_civit, folder=folder)
344
  try:
345
+ print("Repo ID: ", user_repo_id)
346
+ print("Current folder: ", folder)
347
+ print(oauth_token.token)
348
  print("Creating repo...")
349
  print(user_repo_id)
350
+ create_repo(repo_id=user_repo_id, private=True, exist_ok=True, token=oauth_token.token)
351
  print("Uploading repo...")
352
  upload_folder(
353
  folder_path=folder,
 
355
  repo_type="model",
356
  token=oauth_token.token
357
  )
 
358
  update_repo_visibility(repo_id=user_repo_id, private=False, token=oauth_token.token)
359
  except Exception as e:
360
  print(e)