Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
sentiment = pipeline( | |
'sentiment-analysis', | |
model='distilbert-base-uncased-finetuned-sst-2-english', | |
framework='pt' # or 'tf' for TensorFlow | |
) | |
def get_sentiment(input_text): | |
result = sentiment(input_text) | |
return f"Label: {result[0]['label']}, Score: {result[0]['score']}" | |
interface = gr.Interface( | |
fn=get_sentiment, # Function to call | |
inputs=gr.Textbox(lines=3, label="입력"), # Input type (text) with label | |
outputs=gr.Textbox(label="output"), # Output type (text) with label | |
title="Sentiment Analysis" # Title of the interface | |
) | |
interface.launch() |