Jorick-python commited on
Commit
d0b9734
·
1 Parent(s): c99a3fd

Fix: add startup delay for MCP race condition

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -103,4 +103,12 @@ async def extract_slidepack(file: UploadFile):
103
  return analyze_slidepack(type("File", (object,), {"name": path}))
104
 
105
  if __name__ == "__main__":
106
- demo.launch(mcp_server=True, server_name="0.0.0.0", server_port=7860)
 
 
 
 
 
 
 
 
 
103
  return analyze_slidepack(type("File", (object,), {"name": path}))
104
 
105
  if __name__ == "__main__":
106
+ import asyncio
107
+
108
+ async def delayed_startup():
109
+ print("⏳ Waiting before MCP launch to avoid race condition...")
110
+ await asyncio.sleep(3) # wait 3 seconds to allow models to finish loading
111
+ print("🚀 Launching with MCP support now.")
112
+ demo.launch(mcp_server=True)
113
+
114
+ asyncio.run(delayed_startup())