Spaces:
Sleeping
Sleeping
Liam Pond
commited on
Commit
Β·
602513b
1
Parent(s):
9062c1f
fixed symlink creation bug
Browse files
app.py
CHANGED
|
@@ -64,11 +64,22 @@ from inference.pipeline import run_inference
|
|
| 64 |
|
| 65 |
def safe_symlink(src, dst):
|
| 66 |
try:
|
| 67 |
-
if
|
| 68 |
-
os.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
except Exception as e:
|
| 70 |
print(f"β Failed to create symlink {dst} -> {src}: {e}")
|
| 71 |
|
|
|
|
| 72 |
HF_ROOT = "/tmp/cantussvs_v1"
|
| 73 |
safe_symlink(os.path.join(HF_ROOT, "checkpoints"), "checkpoints")
|
| 74 |
safe_symlink(os.path.join(HF_ROOT, "data"), "data")
|
|
|
|
| 64 |
|
| 65 |
def safe_symlink(src, dst):
|
| 66 |
try:
|
| 67 |
+
if os.path.islink(dst):
|
| 68 |
+
if os.readlink(dst) == src:
|
| 69 |
+
print(f"β
Symlink already correct: {dst} β {src}")
|
| 70 |
+
return
|
| 71 |
+
else:
|
| 72 |
+
print(f"β οΈ Symlink exists but points elsewhere. Skipping: {dst}")
|
| 73 |
+
return
|
| 74 |
+
elif os.path.exists(dst):
|
| 75 |
+
print(f"β Cannot create symlink, path exists and is not a symlink: {dst}")
|
| 76 |
+
return
|
| 77 |
+
os.symlink(src, dst)
|
| 78 |
+
print(f"β
Created symlink: {dst} β {src}")
|
| 79 |
except Exception as e:
|
| 80 |
print(f"β Failed to create symlink {dst} -> {src}: {e}")
|
| 81 |
|
| 82 |
+
|
| 83 |
HF_ROOT = "/tmp/cantussvs_v1"
|
| 84 |
safe_symlink(os.path.join(HF_ROOT, "checkpoints"), "checkpoints")
|
| 85 |
safe_symlink(os.path.join(HF_ROOT, "data"), "data")
|