KoreanSentiment / app.py
MatthewBurke1995
Add application file
0734723
raw
history blame contribute delete
490 Bytes
import gradio as gr
from transformers import pipeline
classifier = pipeline("text-classification", model="matthewburke/korean_sentiment")
def predict(text):
result = classifier(text, return_all_scores=True)[0]
positive_score = result[1]['score']
negative_score = result[0]['score']
return {"positive": positive_score, "negative": negative_score}
iface = gr.Interface(
fn=predict,
inputs='text',
outputs='label',
examples=[["μ˜ν™”κ°€ μž¬λ°Œμ—ˆλ‹€"]]
)
iface.launch()