Spaces:
Runtime error
Runtime error
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() |