Spaces:
Sleeping
Sleeping
Modify the path to fix the app.py file path missing bug
Browse files
app.py
CHANGED
|
@@ -10,14 +10,14 @@ from pathlib import Path
|
|
| 10 |
# 1. Download a snapshot of the private Space’s repo into a local cache directory
|
| 11 |
cache_dir = Path("private_space_cache")
|
| 12 |
cache_dir.mkdir(exist_ok=True)
|
| 13 |
-
snapshot_download(
|
| 14 |
repo_id="bobfu/WordDocxFormatConvertor",
|
| 15 |
repo_type="space",
|
| 16 |
cache_dir=str(cache_dir),
|
| 17 |
-
)
|
| 18 |
|
| 19 |
# 2. Load the main app script from the private repo
|
| 20 |
-
app_path =
|
| 21 |
spec = importlib.util.spec_from_file_location("private_app", str(app_path))
|
| 22 |
private_app = importlib.util.module_from_spec(spec)
|
| 23 |
spec.loader.exec_module(private_app)
|
|
|
|
| 10 |
# 1. Download a snapshot of the private Space’s repo into a local cache directory
|
| 11 |
cache_dir = Path("private_space_cache")
|
| 12 |
cache_dir.mkdir(exist_ok=True)
|
| 13 |
+
downloaded_dir = snapshot_download(
|
| 14 |
repo_id="bobfu/WordDocxFormatConvertor",
|
| 15 |
repo_type="space",
|
| 16 |
cache_dir=str(cache_dir),
|
| 17 |
+
) # downloaded_dir is something like "private_space_cache/bobfu/WordDocxFormatConvertor"
|
| 18 |
|
| 19 |
# 2. Load the main app script from the private repo
|
| 20 |
+
app_path = Path(downloaded_dir) / "app.py"
|
| 21 |
spec = importlib.util.spec_from_file_location("private_app", str(app_path))
|
| 22 |
private_app = importlib.util.module_from_spec(spec)
|
| 23 |
spec.loader.exec_module(private_app)
|