nlp_sentiment / app.py
amaldevc's picture
Update app.py
1c1148e verified
raw
history blame contribute delete
344 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline(task="sentiment-analysis", model="amaldevc/nlp_sentiment")
def predict(review):
pred = pipe.predict(review)
return pred[0]["label"] + " with score " + str(pred[0]["score"])
iface = gr.Interface(fn=predict, inputs=gr.Textbox(), outputs=gr.Textbox())
iface.launch()