update
Browse files
app.py
CHANGED
@@ -2239,8 +2239,11 @@ with gr.Blocks(
|
|
2239 |
exist_ok=True
|
2240 |
)
|
2241 |
print("Duplicated Svelte repo result:", duplicated_repo, type(duplicated_repo))
|
2242 |
-
#
|
2243 |
-
|
|
|
|
|
|
|
2244 |
# Parse the Svelte output to get the custom files
|
2245 |
files = parse_svelte_output(code)
|
2246 |
|
@@ -2259,7 +2262,7 @@ with gr.Blocks(
|
|
2259 |
api.upload_file(
|
2260 |
path_or_fileobj=temp_path,
|
2261 |
path_in_repo="src/App.svelte",
|
2262 |
-
repo_id=
|
2263 |
repo_type="space"
|
2264 |
)
|
2265 |
except Exception as e:
|
@@ -2282,7 +2285,7 @@ with gr.Blocks(
|
|
2282 |
api.upload_file(
|
2283 |
path_or_fileobj=temp_path,
|
2284 |
path_in_repo="src/app.css",
|
2285 |
-
repo_id=
|
2286 |
repo_type="space"
|
2287 |
)
|
2288 |
except Exception as e:
|
@@ -2305,7 +2308,7 @@ with gr.Blocks(
|
|
2305 |
api.upload_file(
|
2306 |
path_or_fileobj=temp_path,
|
2307 |
path_in_repo="src/lib/Counter.svelte",
|
2308 |
-
repo_id=
|
2309 |
repo_type="space"
|
2310 |
)
|
2311 |
except Exception as e:
|
@@ -2319,7 +2322,7 @@ with gr.Blocks(
|
|
2319 |
os.unlink(temp_path)
|
2320 |
|
2321 |
# Success - all files uploaded
|
2322 |
-
space_url = f"https://huggingface.co/spaces/{
|
2323 |
action_text = "Updated" if is_update else "Deployed"
|
2324 |
return gr.update(value=f"✅ {action_text}! [Open your Svelte Space here]({space_url})", visible=True)
|
2325 |
|
|
|
2239 |
exist_ok=True
|
2240 |
)
|
2241 |
print("Duplicated Svelte repo result:", duplicated_repo, type(duplicated_repo))
|
2242 |
+
# Extract the actual repo ID from the duplicated space
|
2243 |
+
actual_repo_id = str(duplicated_repo).split('/')[-1] # Get the repo name from the URL
|
2244 |
+
actual_repo_id = f"{profile.username}/{actual_repo_id}" # Add username prefix
|
2245 |
+
print("Actual repo ID for Svelte uploads:", actual_repo_id)
|
2246 |
+
|
2247 |
# Parse the Svelte output to get the custom files
|
2248 |
files = parse_svelte_output(code)
|
2249 |
|
|
|
2262 |
api.upload_file(
|
2263 |
path_or_fileobj=temp_path,
|
2264 |
path_in_repo="src/App.svelte",
|
2265 |
+
repo_id=actual_repo_id,
|
2266 |
repo_type="space"
|
2267 |
)
|
2268 |
except Exception as e:
|
|
|
2285 |
api.upload_file(
|
2286 |
path_or_fileobj=temp_path,
|
2287 |
path_in_repo="src/app.css",
|
2288 |
+
repo_id=actual_repo_id,
|
2289 |
repo_type="space"
|
2290 |
)
|
2291 |
except Exception as e:
|
|
|
2308 |
api.upload_file(
|
2309 |
path_or_fileobj=temp_path,
|
2310 |
path_in_repo="src/lib/Counter.svelte",
|
2311 |
+
repo_id=actual_repo_id,
|
2312 |
repo_type="space"
|
2313 |
)
|
2314 |
except Exception as e:
|
|
|
2322 |
os.unlink(temp_path)
|
2323 |
|
2324 |
# Success - all files uploaded
|
2325 |
+
space_url = f"https://huggingface.co/spaces/{actual_repo_id}"
|
2326 |
action_text = "Updated" if is_update else "Deployed"
|
2327 |
return gr.update(value=f"✅ {action_text}! [Open your Svelte Space here]({space_url})", visible=True)
|
2328 |
|