clothing / app.py
Preetham04's picture
Update app.py
0539c21 verified
raw
history blame
646 Bytes
import gradio as gr
from transformers import pipeline
pipeline = pipeline(task="text-classification", model="Preetham04/sentiment_analysis")
def predict(input_text):
predictions = pipeline(input_text)
print(predictions)
result = []
for p in predictions:
review = "POSITIVE" if p["label"] == "LABEL_1" else "NEGATIVE"
result.append({
"SENTIMENT": review,
"SCORE": p["score"]
})
return result
gradio_app = gr.Interface(
predict,
inputs="textbox",
outputs="text",
title="Sentiment- good or bad?",
)
if __name__ == "__main__":
gradio_app.launch(share=True)