from fastapi import FastAPI from fastapi.responses import HTMLResponse from transformers import pipeline app = FastAPI() classifier = pipeline("sentiment-analysis") html = """ Sentiment Checker

Sentiment Checker

""" @app.get("/", response_class=HTMLResponse) def home(): return html @app.get("/predict") def predict(text: str): return classifier(text)