|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
|
|
|
|
sentiment_analysis = pipeline("sentiment-analysis") |
|
|
|
def get_sentiment(text): |
|
|
|
result = sentiment_analysis(text) |
|
|
|
formatted_result = f"Label: {result[0]['label']}, Score: {result[0]['score']:.4f}" |
|
return formatted_result |
|
|
|
|
|
interface = gr.Interface( |
|
fn=get_sentiment, |
|
inputs=gr.inputs.Textbox(lines=2, placeholder="์ฌ๊ธฐ์ ํ
์คํธ๋ฅผ ์
๋ ฅํ์ธ์..."), |
|
outputs="text", |
|
title="Text Sentiment Analysis", |
|
description="This app analyzes the sentiment of input text. Enter text to see if it's positive or negative." |
|
) |
|
|
|
|
|
interface.launch() |
|
|