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")