scorpion237's picture
Create app.py
e73e52d
raw
history blame contribute delete
No virus
389 Bytes
import gradio as gr
from transformers import pipeline
sentiment = pipeline("sentiment-analysis")
def get_sentiment(input_text):
result = sentiment(input_text)
final = result[0]["label"]
if final == "POSITIVE":
return "POSITIVE SENTIMENT"
else:
return "NEGATIVE SENTIMENT"
app = gr.Interface(fn=get_sentiment, inputs=gr.components.Textbox(), outputs="text")
app.launch()