# app.py | |
from fastapi import FastAPI | |
from classifier import Classifier | |
import nlp | |
import logging | |
logging.basicConfig(level = logging.INFO) | |
# Create the FastAPI instance | |
app = FastAPI(docs_url='/', redoc_url='/new_redoc') | |
classifier = Classifier() | |
def predict(data: dict): | |
try: | |
input_text = data["text"] | |
res = nlp.sentiment_analysis(classifier, input_text) | |
return res | |
except Exception as e: | |
logging.error("Something went wrong") |