aidpc commited on
Commit
a2343c7
·
verified ·
1 Parent(s): 897e9ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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
- name: str
8
 
9
  @app.post("/hello")
10
  def say_hello(data: Input):
11
- return {"message": f"Hello {data.name}!"}
 
 
 
 
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}