Spaces:
Sleeping
Sleeping
Create app.py
Browse files123456789101112131415161718192021222324252627from fastapi import FastAPIfrom pydantic import BaseModel
app = FastAPI()
# Request schemaclass DataRequest(BaseModel): message: str
# Static valueSTATIC_VALUE = "Hello from Hugging Face Space!"
@app.get("/")def root(): return {"info": "FastAPI app is running on Hugging Face Spaces"}
@app.post("/send")def send_data(data: DataRequest): # Just return the static value regardless of input return { "received": data.message, "response": STATIC_VALUE }
@app.get("/get")def get_data(): return {"data": STATIC_VALUE}app.pyAdded+27