Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# 'sentiment-analysis' νμ΄νλΌμΈ μ΄κΈ°ν | |
sentiment = pipeline('sentiment-analysis') | |
# κ°μ± λΆμμ μννλ ν¨μ μ μ | |
def get_sentiment(text): | |
result = sentiment(text) | |
return result[0] | |
# Gradio μΈν°νμ΄μ€ μ μ | |
interface = gr.Interface(fn=get_sentiment, | |
inputs=gr.inputs.Textbox(lines=2, placeholder="Type your text here..."), | |
outputs='json', | |
title="Sentiment Analysis", | |
description="Enter text to analyze sentiment.") | |
# Gradio μ± μ€ν | |
if __name__ == "__main__": | |
interface.launch() | |