Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
|
| 3 |
app = FastAPI()
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
@app.post("/")
|
| 6 |
-
def read_root():
|
|
|
|
|
|
|
| 7 |
return {"Hello": "World!"}
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
+
class TextRatingRequest(BaseModel):
|
| 7 |
+
text: str
|
| 8 |
+
rating: int
|
| 9 |
+
|
| 10 |
@app.post("/")
|
| 11 |
+
def read_root(text_rating: TextRatingRequest):
|
| 12 |
+
text = text_rating.text
|
| 13 |
+
rating = text_rating.rating
|
| 14 |
return {"Hello": "World!"}
|