square_fastapi / app.py
stpete2's picture
Create app.py
d7ff1c2 verified
raw
history blame
215 Bytes
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class InputData(BaseModel):
x: float
@app.post("/square")
def double_number(data: InputData):
return {"result": data.x * data.x}