Update app.py
Browse files
app.py
CHANGED
@@ -269,12 +269,16 @@ Medical Records:
|
|
269 |
outputs=[chatbot, download_output, conversation_state])
|
270 |
return demo
|
271 |
|
|
|
|
|
|
|
272 |
if __name__ == "__main__":
|
273 |
try:
|
274 |
print("🚀 Launching app...")
|
275 |
agent = init_agent()
|
276 |
demo = create_ui(agent)
|
277 |
-
|
|
|
278 |
server_name="0.0.0.0",
|
279 |
server_port=7860,
|
280 |
show_error=True,
|
@@ -282,6 +286,8 @@ if __name__ == "__main__":
|
|
282 |
share=False,
|
283 |
ssr=False # Disable SSR to improve UI updates
|
284 |
)
|
|
|
|
|
285 |
except Exception as e:
|
286 |
print("❌ Fatal error during launch:", str(e))
|
287 |
traceback.print_exc()
|
|
|
269 |
outputs=[chatbot, download_output, conversation_state])
|
270 |
return demo
|
271 |
|
272 |
+
# Global variable to hold the WSGI/ASGI app for container environments.
|
273 |
+
app = None
|
274 |
+
|
275 |
if __name__ == "__main__":
|
276 |
try:
|
277 |
print("🚀 Launching app...")
|
278 |
agent = init_agent()
|
279 |
demo = create_ui(agent)
|
280 |
+
# Launch the app with queueing; capture the returned app instance.
|
281 |
+
launched_app, local_url, share_url = demo.queue(api_open=False).launch(
|
282 |
server_name="0.0.0.0",
|
283 |
server_port=7860,
|
284 |
show_error=True,
|
|
|
286 |
share=False,
|
287 |
ssr=False # Disable SSR to improve UI updates
|
288 |
)
|
289 |
+
# Assign the underlying web app to the global variable for container access.
|
290 |
+
app = launched_app.app
|
291 |
except Exception as e:
|
292 |
print("❌ Fatal error during launch:", str(e))
|
293 |
traceback.print_exc()
|