Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from pydantic import BaseModel
|
|
|
|
| 3 |
|
| 4 |
app=FastAPI()
|
| 5 |
|
| 6 |
class Input(BaseModel):
|
| 7 |
-
|
| 8 |
|
| 9 |
@app.post("/hello")
|
| 10 |
def say_hello(data: Input):
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from pydantic import BaseModel
|
| 3 |
+
import time
|
| 4 |
|
| 5 |
app=FastAPI()
|
| 6 |
|
| 7 |
class Input(BaseModel):
|
| 8 |
+
texts: list
|
| 9 |
|
| 10 |
@app.post("/hello")
|
| 11 |
def say_hello(data: Input):
|
| 12 |
+
now=time.time()
|
| 13 |
+
output=list(map(len, data.texts))
|
| 14 |
+
|
| 15 |
+
return {"data": output, "duration": time.time()-now}
|