Spaces:
Running
Running
Melika Kheirieh
commited on
Commit
·
7e5facf
1
Parent(s):
a5a91fa
fix(docker): set PORT env and ensure Gradio launches on correct port
Browse files- .coverage +0 -0
- Dockerfile +1 -0
- start.py +3 -0
.coverage
CHANGED
|
Binary files a/.coverage and b/.coverage differ
|
|
|
Dockerfile
CHANGED
|
@@ -50,6 +50,7 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
| 50 |
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:7860', timeout=2)"
|
| 51 |
|
| 52 |
# Hugging Face Spaces expect public app on port 7860
|
|
|
|
| 53 |
EXPOSE 7860
|
| 54 |
|
| 55 |
RUN echo "==== DEBUG LISTING /app ====" && ls -R /app
|
|
|
|
| 50 |
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:7860', timeout=2)"
|
| 51 |
|
| 52 |
# Hugging Face Spaces expect public app on port 7860
|
| 53 |
+
ENV PORT=7860
|
| 54 |
EXPOSE 7860
|
| 55 |
|
| 56 |
RUN echo "==== DEBUG LISTING /app ====" && ls -R /app
|
start.py
CHANGED
|
@@ -23,6 +23,7 @@ def run_fastapi():
|
|
| 23 |
|
| 24 |
def run_gradio():
|
| 25 |
"""Build and launch Gradio UI on the Space's PORT."""
|
|
|
|
| 26 |
from demo.app import build_ui
|
| 27 |
|
| 28 |
demo = build_ui()
|
|
@@ -36,8 +37,10 @@ def run_gradio():
|
|
| 36 |
|
| 37 |
if __name__ == "__main__":
|
| 38 |
# Start FastAPI in background thread
|
|
|
|
| 39 |
t = threading.Thread(target=run_fastapi, daemon=True)
|
| 40 |
t.start()
|
| 41 |
|
| 42 |
# Run Gradio in foreground (keeps container alive)
|
|
|
|
| 43 |
run_gradio()
|
|
|
|
| 23 |
|
| 24 |
def run_gradio():
|
| 25 |
"""Build and launch Gradio UI on the Space's PORT."""
|
| 26 |
+
print("[start] about to launch gradio on PORT=", os.getenv("PORT"), flush=True)
|
| 27 |
from demo.app import build_ui
|
| 28 |
|
| 29 |
demo = build_ui()
|
|
|
|
| 37 |
|
| 38 |
if __name__ == "__main__":
|
| 39 |
# Start FastAPI in background thread
|
| 40 |
+
print("[start] launching uvicorn thread...", flush=True)
|
| 41 |
t = threading.Thread(target=run_fastapi, daemon=True)
|
| 42 |
t.start()
|
| 43 |
|
| 44 |
# Run Gradio in foreground (keeps container alive)
|
| 45 |
+
print("[start] about to launch gradio on PORT=", os.getenv("PORT"), flush=True)
|
| 46 |
run_gradio()
|