Spaces:
Running
Running
Fix: install wheels from app.py, remove local paths from requirements.txt
Browse files- app.py +23 -1
- requirements.txt +0 -9
app.py
CHANGED
|
@@ -18,9 +18,31 @@ import os
|
|
| 18 |
import subprocess
|
| 19 |
import sys
|
| 20 |
import tempfile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
import uuid
|
| 22 |
from datetime import datetime, timezone
|
| 23 |
-
from pathlib import Path
|
| 24 |
|
| 25 |
import gradio as gr
|
| 26 |
|
|
|
|
| 18 |
import subprocess
|
| 19 |
import sys
|
| 20 |
import tempfile
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
# ---------------------------------------------------------------------------
|
| 24 |
+
# Install bundled Legesher wheels (not on PyPI) — runs on HF Spaces startup
|
| 25 |
+
# ---------------------------------------------------------------------------
|
| 26 |
+
def _install_legesher_wheels():
|
| 27 |
+
wheels_dir = Path(__file__).parent / "wheels"
|
| 28 |
+
if not wheels_dir.exists():
|
| 29 |
+
return
|
| 30 |
+
wheels = sorted(wheels_dir.glob("*.whl"))
|
| 31 |
+
if not wheels:
|
| 32 |
+
return
|
| 33 |
+
print(f"Installing {len(wheels)} Legesher wheel(s)...")
|
| 34 |
+
result = subprocess.run(
|
| 35 |
+
[sys.executable, "-m", "pip", "install", "--quiet"] + [str(w) for w in wheels],
|
| 36 |
+
capture_output=True, text=True
|
| 37 |
+
)
|
| 38 |
+
if result.returncode == 0:
|
| 39 |
+
print("Legesher wheels installed.")
|
| 40 |
+
else:
|
| 41 |
+
print("Wheel install warning:", result.stderr[-300:])
|
| 42 |
+
|
| 43 |
+
_install_legesher_wheels()
|
| 44 |
import uuid
|
| 45 |
from datetime import datetime, timezone
|
|
|
|
| 46 |
|
| 47 |
import gradio as gr
|
| 48 |
|
requirements.txt
CHANGED
|
@@ -3,12 +3,3 @@ huggingface_hub>=0.24.0
|
|
| 3 |
datasets>=2.20.0
|
| 4 |
tree-sitter>=0.20.4
|
| 5 |
tree-sitter-python>=0.21.0
|
| 6 |
-
|
| 7 |
-
# Legesher packages (bundled in wheels/)
|
| 8 |
-
./wheels/legesher_core-0.7.3-py3-none-any.whl
|
| 9 |
-
./wheels/legesher_i18n-0.7.3-py3-none-any.whl
|
| 10 |
-
./wheels/legesher-0.7.3-py3-none-any.whl
|
| 11 |
-
./wheels/legesher_i18n_python_en-0.0.2-py3-none-any.whl
|
| 12 |
-
./wheels/legesher_i18n_python_zh-0.0.4-py3-none-any.whl
|
| 13 |
-
./wheels/legesher_i18n_python_es-0.0.3-py3-none-any.whl
|
| 14 |
-
./wheels/legesher_i18n_python_ur-0.0.2-py3-none-any.whl
|
|
|
|
| 3 |
datasets>=2.20.0
|
| 4 |
tree-sitter>=0.20.4
|
| 5 |
tree-sitter-python>=0.21.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|