Spaces:
Running
Running
| """ | |
| Hugging Face Spaces entry point. | |
| Spaces expects a file named app.py at the repo root. This module simply | |
| imports and runs the Gradio app from the `app/` package. Environment | |
| variables (MINIMAX_API_KEY, CHATTERBOX_API_BASE_URL, ...) are injected | |
| by the Spaces runtime from the "Variables and secrets" settings tab. | |
| """ | |
| from __future__ import annotations | |
| import logging | |
| import os | |
| # Configure logging before anything else so startup warnings surface in | |
| # the Space's "Logs" panel. | |
| logging.basicConfig( | |
| level=os.getenv("LOG_LEVEL", "INFO"), | |
| format="%(asctime)s %(levelname)s %(name)s: %(message)s", | |
| ) | |
| # Import the Gradio UI builder from the app package. | |
| from app.ui import build_app # noqa: E402 | |
| demo = build_app() | |
| if __name__ == "__main__": | |
| # Spaces forwards port 7860 by default. share=False because HF serves | |
| # the public URL itself. | |
| demo.launch(server_name="0.0.0.0", server_port=7860, share=False) | |