Spaces:
Sleeping
Sleeping
File size: 681 Bytes
748571c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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()
|