File size: 295 Bytes
c13d1c7
 
a2343c7
c13d1c7
 
 
 
a2343c7
c13d1c7
 
 
a2343c7
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from fastapi import FastAPI
from pydantic import BaseModel
import time

app=FastAPI()

class Input(BaseModel):
    texts: list

@app.post("/hello")
def say_hello(data: Input):
    now=time.time()
    output=list(map(len, data.texts))
    
    return {"data": output, "duration": time.time()-now}