File size: 355 Bytes
7a1bfc8
 
 
 
 
 
 
 
 
350cb8a
7a1bfc8
 
ec02dbd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from fastapi import FastAPI
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer

app = FastAPI()
    
@app.get("/")
def greet_json():
    return {"Hello": "World!"}

@app.post("/sentiment")
def sentiment_analysis(message: str):
    analyzer = SentimentIntensityAnalyzer()
    return analyzer.polarity_scores("This is a positive message")