Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| app = FastAPI() | |
| # Request schema | |
| class DataRequest(BaseModel): | |
| message: str | |
| # Static value | |
| STATIC_VALUE = "Hello from Hugging Face Space!" | |
| def root(): | |
| return {"info": "FastAPI app is running on Hugging Face Spaces"} | |
| def send_data(data: DataRequest): | |
| # Just return the static value regardless of input | |
| return { | |
| "received": data.message, | |
| "response": STATIC_VALUE | |
| } | |
| def get_data(): | |
| return {"data": STATIC_VALUE} | |