tharunchndrn commited on
Commit
ce23a62
·
verified ·
1 Parent(s): a94a9b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -101,4 +101,16 @@ with gr.Blocks(title="SysLink Food System Chatbot") as demo:
101
  b.click(suggestion_click, inputs=[b, chat, state], outputs=[user_in, chat, state, s1, s2, s3, s4, s5, s6])
102
 
103
  # ✅ Required for Hugging Face Gradio runtime stability
104
- demo.queue()
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  b.click(suggestion_click, inputs=[b, chat, state], outputs=[user_in, chat, state, s1, s2, s3, s4, s5, s6])
102
 
103
  # ✅ Required for Hugging Face Gradio runtime stability
104
+ demo.queue()
105
+
106
+ # ✅ Keep the Space running (your Space exits without this)
107
+ if __name__ == "__main__":
108
+ # Hugging Face sets one fixed port (often 7861). Use it if provided.
109
+ port = int(os.environ.get("GRADIO_SERVER_PORT") or os.environ.get("PORT") or "7860")
110
+ os.environ["GRADIO_SERVER_PORT"] = str(port)
111
+
112
+ demo.launch(
113
+ server_name="0.0.0.0",
114
+ server_port=port,
115
+ show_error=True,
116
+ )