File size: 572 Bytes
0e17006 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
"""
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)
|