rabindra-sss commited on
Commit
b64b305
·
verified ·
1 Parent(s): bfb57dd

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +18 -19
main.py CHANGED
@@ -1,19 +1,18 @@
1
- from fastapi import FastAPI
2
- from pydantic import BaseModel
3
- from backend import predict
4
- from mangum import Mangum
5
-
6
- app = FastAPI()
7
-
8
- handler = Mangum(app)
9
- class Input(BaseModel):
10
- text: str
11
-
12
- @app.get("/")
13
- async def root():
14
- return {"message": "Sentiment Analysis API is running!"}
15
-
16
- @app.post("/predict/")
17
- async def predict_sentiment(input: Input):
18
- prediction = predict(input.text)
19
- return {"text": input.text, "sentiment": prediction}
 
1
+ from fastapi import FastAPI
2
+ from pydantic import BaseModel
3
+ from backend import predict
4
+
5
+ app = FastAPI()
6
+
7
+ handler = Mangum(app)
8
+ class Input(BaseModel):
9
+ text: str
10
+
11
+ @app.get("/")
12
+ async def root():
13
+ return {"message": "Sentiment Analysis API is running!"}
14
+
15
+ @app.post("/predict/")
16
+ async def predict_sentiment(input: Input):
17
+ prediction = predict(input.text)
18
+ return {"text": input.text, "sentiment": prediction}