Deploy MidasMap Gradio app; weights downloaded from model repo at runtime
Browse files- app.py +3 -0
- requirements.txt +2 -2
app.py
CHANGED
|
@@ -882,6 +882,9 @@ Sahai, A. (2026). *MidasMap* (software). https://github.com/AnikS22/MidasMap
|
|
| 882 |
|
| 883 |
def _running_on_hf_space() -> bool:
|
| 884 |
"""Hugging Face Spaces injects these env vars; Gradio must bind 0.0.0.0 and never use share=True."""
|
|
|
|
|
|
|
|
|
|
| 885 |
return bool(
|
| 886 |
os.environ.get("SPACE_REPO_NAME")
|
| 887 |
or os.environ.get("SPACE_AUTHOR_NAME")
|
|
|
|
| 882 |
|
| 883 |
def _running_on_hf_space() -> bool:
|
| 884 |
"""Hugging Face Spaces injects these env vars; Gradio must bind 0.0.0.0 and never use share=True."""
|
| 885 |
+
# Gradio's own detector uses SYSTEM=spaces + SPACE_ID; keep checks in sync so launch() binds correctly.
|
| 886 |
+
if os.environ.get("SYSTEM") == "spaces":
|
| 887 |
+
return True
|
| 888 |
return bool(
|
| 889 |
os.environ.get("SPACE_REPO_NAME")
|
| 890 |
or os.environ.get("SPACE_AUTHOR_NAME")
|
requirements.txt
CHANGED
|
@@ -14,7 +14,7 @@ PyYAML>=6.0
|
|
| 14 |
albumentations>=1.3.0
|
| 15 |
opencv-python-headless>=4.7.0
|
| 16 |
gradio==4.44.1
|
| 17 |
-
#
|
| 18 |
-
jinja2
|
| 19 |
huggingface_hub>=0.20.0,<0.25.0
|
| 20 |
tqdm>=4.65.0
|
|
|
|
| 14 |
albumentations>=1.3.0
|
| 15 |
opencv-python-headless>=4.7.0
|
| 16 |
gradio==4.44.1
|
| 17 |
+
# Pin below 3.2: Jinja 3.2+ breaks Gradio 4.44 + Starlette (unhashable dict in template cache) on Spaces.
|
| 18 |
+
jinja2==3.1.6
|
| 19 |
huggingface_hub>=0.20.0,<0.25.0
|
| 20 |
tqdm>=4.65.0
|