Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -20,28 +20,7 @@ from pathlib import Path
|
|
| 20 |
# ββ Fix import path ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 21 |
# On HF Spaces, app.py sits at the repo root alongside gazerefine/ and
|
| 22 |
# scripts/, so we add the directory that contains THIS file (not its parent).
|
| 23 |
-
|
| 24 |
-
sys.path.insert(0, str(_APP_DIR))
|
| 25 |
-
|
| 26 |
-
# ββ Sanity-check / self-heal the scripts/ package ββββββββββββββββββββββββββββ
|
| 27 |
-
# If this raises, scripts/ genuinely isn't present in the deployed repo
|
| 28 |
-
# (check the Space's "Files" tab β a common cause is pushing to GitHub but
|
| 29 |
-
# not to the Space's own git remote). If only __init__.py is missing, we
|
| 30 |
-
# create it here so `from scripts.predict_single import ...` resolves.
|
| 31 |
-
_scripts_dir = _APP_DIR / "scripts"
|
| 32 |
-
if not _scripts_dir.exists():
|
| 33 |
-
raise RuntimeError(
|
| 34 |
-
f"scripts/ directory not found at {_scripts_dir} β "
|
| 35 |
-
"check that the Space repo includes it (it may be missing from "
|
| 36 |
-
"the deployed commit)."
|
| 37 |
-
)
|
| 38 |
-
if not (_scripts_dir / "predict_single.py").exists():
|
| 39 |
-
raise RuntimeError(
|
| 40 |
-
f"scripts/predict_single.py not found in {_scripts_dir} β "
|
| 41 |
-
"check that this file is committed to the Space repo."
|
| 42 |
-
)
|
| 43 |
-
if not (_scripts_dir / "__init__.py").exists():
|
| 44 |
-
(_scripts_dir / "__init__.py").touch()
|
| 45 |
|
| 46 |
import gradio as gr
|
| 47 |
import numpy as np
|
|
@@ -249,5 +228,7 @@ with gr.Blocks(title="GazeRefine", theme=gr.themes.Soft()) as demo:
|
|
| 249 |
)
|
| 250 |
|
| 251 |
|
|
|
|
|
|
|
| 252 |
if __name__ == "__main__":
|
| 253 |
demo.launch()
|
|
|
|
| 20 |
# ββ Fix import path ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 21 |
# On HF Spaces, app.py sits at the repo root alongside gazerefine/ and
|
| 22 |
# scripts/, so we add the directory that contains THIS file (not its parent).
|
| 23 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
import gradio as gr
|
| 26 |
import numpy as np
|
|
|
|
| 228 |
)
|
| 229 |
|
| 230 |
|
| 231 |
+
demo.queue()
|
| 232 |
+
|
| 233 |
if __name__ == "__main__":
|
| 234 |
demo.launch()
|