File size: 472 Bytes
e548193 b08b610 e548193 ca9aa15 e548193 b59078e e548193 df16f8c e548193 d1bf629 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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()
@app.post("/predict")
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") |