Spaces:
Sleeping
Sleeping
File size: 589 Bytes
8d09e05 1a0689b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import gradio as gr
from transformers import pipeline
# ๊ฐ์ ๋ถ์ ๋ชจ๋ธ์ ๋ถ๋ฌ์ต๋๋ค.
classifier = pipeline("sentiment-analysis")
# ์์ธก ํจ์ ์ ์
def sentiment_analysis(text):
result = classifier(text)[0]
label = result['label']
score = result['score']
return f"Label: {label}, Score: {score:.2f}"
# Gradio ์ธํฐํ์ด์ค ์ค์
iface = gr.Interface(
fn=sentiment_analysis,
inputs="text",
outputs="text",
title="Sentiment Analysis",
description="Enter text to analyze its sentiment.",
)
# ์ ํ๋ฆฌ์ผ์ด์
์คํ
iface.launch()
|