Nymbo commited on
Commit
b86e388
·
verified ·
1 Parent(s): 1efe1aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -35,14 +35,21 @@ def main():
35
  demo = ui_components.create_interface()
36
 
37
  # Launch the application
38
- demo.launch(
39
- debug=AppConfig.DEBUG_MODE,
40
- share=False, # Set to True if you want to create a public link
41
- server_name="0.0.0.0", # Allow external connections
42
- server_port=7860, # Default Gradio port
43
- auth=None, # No authentication (handled by HF login)
44
- max_threads=40 # Allow multiple concurrent users
45
- )
 
 
 
 
 
 
 
46
 
47
  logger.info("✅ Universal MCP Client started successfully!")
48
 
 
35
  demo = ui_components.create_interface()
36
 
37
  # Launch the application
38
+ # On Hugging Face Spaces, let Gradio/HF set host/port and OAuth config to ensure redirect_uri matches the Space domain.
39
+ if os.getenv("SPACE_ID"):
40
+ demo.launch(
41
+ debug=False,
42
+ max_threads=40
43
+ )
44
+ else:
45
+ demo.launch(
46
+ debug=AppConfig.DEBUG_MODE,
47
+ share=False, # Set to True if you want to create a public link
48
+ server_name="0.0.0.0", # Allow external connections
49
+ server_port=int(os.getenv("PORT", "7860")),
50
+ auth=None, # No authentication (handled by HF login)
51
+ max_threads=40 # Allow multiple concurrent users
52
+ )
53
 
54
  logger.info("✅ Universal MCP Client started successfully!")
55