from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class ChatRequest(BaseModel): prompt: str @app.get("/") def root(): return { "status": "running", "message": "Space is working" } @app.get("/health") def health(): return { "healthy": True } @app.post("/chat") def chat(req: ChatRequest): return { "reply": f"You said: {req.prompt}" }