short / app.py
tamatwi's picture
Create app.py
8108da4 verified
raw
history blame contribute delete
474 Bytes
import gradio as gr
from transformers import pipeline
sentiment_analyzer = pipeline("sentiment-analysis")
def analyze_sentiment(text):
result = sentiment_analyzer(text)[0]
return f"ๆ„Ÿๆƒ…: {result['label']}, ็ขบไฟกๅบฆ: {result['score']:.2f}"
iface = gr.Interface(
fn=analyze_sentiment,
inputs="text",
outputs="text",
title="็ฐกๅ˜ใชๆ„Ÿๆƒ…ๅˆ†ๆž",
description="ใƒ†ใ‚ญใ‚นใƒˆใ‚’ๅ…ฅๅŠ›ใ—ใฆใ€ใใฎๆ„Ÿๆƒ…ใ‚’ๅˆ†ๆžใ—ใพใ™ใ€‚"
)
iface.launch()