Melika Kheirieh commited on
Commit
c8b0bcb
·
1 Parent(s): 98694e9

fix(hf-space): forward Gradio logs and ensure server binds to 0.0.0.0:7860

Browse files
Files changed (2) hide show
  1. Dockerfile +16 -0
  2. demo/app.py +3 -0
Dockerfile CHANGED
@@ -43,3 +43,19 @@ EXPOSE 8000
43
 
44
  # ---------- Entrypoint ----------
45
  CMD ["supervisord", "-c", "/etc/supervisord.conf"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  # ---------- Entrypoint ----------
45
  CMD ["supervisord", "-c", "/etc/supervisord.conf"]
46
+
47
+ # ---------- Supervisor config ----------
48
+ RUN echo "[supervisord]" > /etc/supervisord.conf \
49
+ && echo "nodaemon=true" >> /etc/supervisord.conf \
50
+ && echo "" >> /etc/supervisord.conf \
51
+ && echo "[program:fastapi]" >> /etc/supervisord.conf \
52
+ && echo "command=uvicorn main:app --host 0.0.0.0 --port 8000" >> /etc/supervisord.conf \
53
+ && echo "autostart=true" >> /etc/supervisord.conf \
54
+ && echo "stdout_logfile=/dev/stdout" >> /etc/supervisord.conf \
55
+ && echo "stderr_logfile=/dev/stderr" >> /etc/supervisord.conf \
56
+ && echo "" >> /etc/supervisord.conf \
57
+ && echo "[program:gradio]" >> /etc/supervisord.conf \
58
+ && echo "command=python app.py" >> /etc/supervisord.conf \
59
+ && echo "autostart=true" >> /etc/supervisord.conf \
60
+ && echo "stdout_logfile=/dev/stdout" >> /etc/supervisord.conf \
61
+ && echo "stderr_logfile=/dev/stderr" >> /etc/supervisord.conf
demo/app.py CHANGED
@@ -188,7 +188,10 @@ with gr.Blocks(title="NL2SQL Copilot") as demo:
188
  if __name__ == "__main__":
189
  import os
190
 
 
191
  demo.launch(
192
  server_name=os.getenv("GRADIO_SERVER_NAME", "0.0.0.0"),
193
  server_port=int(os.getenv("GRADIO_SERVER_PORT", "7860")),
 
 
194
  )
 
188
  if __name__ == "__main__":
189
  import os
190
 
191
+ print("[demo] Launching Gradio demo on 0.0.0.0:7860 ...", flush=True)
192
  demo.launch(
193
  server_name=os.getenv("GRADIO_SERVER_NAME", "0.0.0.0"),
194
  server_port=int(os.getenv("GRADIO_SERVER_PORT", "7860")),
195
+ share=False,
196
+ debug=True,
197
  )