Spaces:
Configuration error
Configuration error
File size: 630 Bytes
42b209f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import uvicorn
import threading
import gradio as gr
from app.main import app as fastapi_app
# run FastAPI in a background thread
def run_fastapi():
uvicorn.run(fastapi_app, host="0.0.0.0", port=7860)
thread = threading.Thread(target=run_fastapi, daemon=True)
thread.start()
# Gradio needs a UI to stay alive — minimal dummy interface
demo = gr.Interface(
fn=lambda x: "Emosaic backend is running!",
inputs=gr.Textbox(label="ping"),
outputs=gr.Textbox(label="status"),
title="🌸 Emosaic Backend",
description="FastAPI backend for Emosaic. Use the /generate endpoint."
)
demo.launch(server_port=7860) |