Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI, status | |
| from pydantic import BaseModel | |
| import gradio as gr | |
| # Define your response model | |
| class HealthCheck(BaseModel): | |
| status: str = "healthy" | |
| # Create FastAPI app | |
| app = FastAPI() | |
| # Add health check endpoint | |
| def get_health() -> HealthCheck: | |
| """ | |
| Health Check Endpoint | |
| This endpoint provides a simple status check to verify the API is running. | |
| """ | |
| return HealthCheck(status="healthy") | |
| # Create your Gradio interface | |
| def greet(name): | |
| return "Hello, " + name + "!" | |
| demo = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| # Mount the Gradio app to the FastAPI app | |
| app = gr.mount_gradio_app(app, demo, path="/") | |