Spaces:
Runtime error
Runtime error
correct one
Browse files
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 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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:
|