| """ | |
| Combined app that runs both Gradio UI and FastAPI endpoints. | |
| This allows HuggingFace Spaces to serve both the UI and API. | |
| """ | |
| import os | |
| import sys | |
| # Import FastAPI app | |
| from fastapi_app import app as fastapi_app | |
| # Import Gradio app | |
| import gradio as gr | |
| from app import demo as gradio_demo | |
| # Mount FastAPI app to Gradio | |
| gradio_demo.mount("/api", fastapi_app) | |
| if __name__ == "__main__": | |
| # For HuggingFace Spaces, Gradio will handle the launch | |
| # The FastAPI endpoints will be available at /api/* | |
| gradio_demo.launch(server_name="0.0.0.0", server_port=7860) | |