souljoy commited on
Commit
ad8b9b4
·
1 Parent(s): d057bd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,11 +1,10 @@
1
  from fastapi import FastAPI
2
  from fastapi.responses import HTMLResponse
3
  from pydantic import BaseModel
 
4
 
5
- class Item(BaseModel):
6
- name: str
7
- price: float
8
-
9
 
10
  app = FastAPI()
11
 
@@ -20,6 +19,7 @@ def home():
20
  def hello():
21
  return {"hello": "world"}
22
 
23
- @app.post("/items")
24
- def update_item(item: Item):
25
- return {"item_name": item.name, "twice price": item.price * 2}
 
 
1
  from fastapi import FastAPI
2
  from fastapi.responses import HTMLResponse
3
  from pydantic import BaseModel
4
+ from fastapi.responses import JSONResponse
5
 
6
+ class Text(BaseModel):
7
+ content: str = ""
 
 
8
 
9
  app = FastAPI()
10
 
 
19
  def hello():
20
  return {"hello": "world"}
21
 
22
+ @app.post("/sentiment-analysis")
23
+ def sentiment_analysis_ep(content: Text = None):
24
+ content = {"message": "hello world"}
25
+ return JSONResponse(content=content)