Update app.py
Browse files
app.py
CHANGED
|
@@ -35,14 +35,21 @@ def main():
|
|
| 35 |
demo = ui_components.create_interface()
|
| 36 |
|
| 37 |
# Launch the application
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 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 |
|