File size: 427 Bytes
58b2d8d bb5c0de 58b2d8d bb5c0de 58b2d8d bb5c0de 58b2d8d bb5c0de 58b2d8d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 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}"
} |