Spaces:
Build error
Build error
| import gradio as gr | |
| from fastapi import FastAPI | |
| import uvicorn | |
| # Create a FastAPI app | |
| app = FastAPI() | |
| # Create Gradio interface (just like in Hugging Face Spaces) | |
| def classify_emotion(text): | |
| # Your model code here (replace this with the actual classification) | |
| return "happy" # example return value | |
| gradio_interface = gr.Interface(fn=classify_emotion, inputs="text", outputs="text") | |
| # Mount the Gradio app inside FastAPI | |
| app.mount("/gradio", gradio_interface) | |
| if __name__ == "__main__": | |
| uvicorn.run(app, host="0.0.0.0", port=7860) | |