Wauplin HF staff commited on
Commit
aa921bb
1 Parent(s): 7295302

correct one

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -134,16 +134,19 @@ def merge(
134
  return
135
 
136
  if hf_token is not None:
137
- api = huggingface_hub.HfApi(token=hf_token)
138
- yield runner.log("Creating repo")
139
- repo_url = api.create_repo(repo_name, exist_ok=True)
140
 
141
- yield runner.log(f"Repo created: {repo_url}")
142
- folder_url = api.upload_folder(
143
- repo_id=repo_url.repo_id, folder_path=merged_path
144
- )
145
-
146
- yield runner.log(f"Model successfully uploaded to {folder_url}")
 
 
 
 
 
 
147
 
148
 
149
  with gr.Blocks() as demo:
 
134
  return
135
 
136
  if hf_token is not None:
 
 
 
137
 
138
+ def upload_to_repo():
139
+ api = huggingface_hub.HfApi(token=hf_token)
140
+ print("Creating repo")
141
+ repo_url = api.create_repo(repo_name, exist_ok=True)
142
+ print(f"Repo created: {repo_url}")
143
+ print("Starting upload")
144
+ folder_url = api.upload_folder(
145
+ repo_id=repo_url.repo_id, folder_path=merged_path / "merge"
146
+ )
147
+ print(f"Model successfully uploaded to {folder_url}")
148
+
149
+ yield from runner.run_python(upload_to_repo)
150
 
151
 
152
  with gr.Blocks() as demo: