File size: 219 Bytes
d7ff1c2
 
 
 
 
 
 
 
 
 
a612928
 
1
2
3
4
5
6
7
8
9
10
11
12
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}