Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# κ°μ λΆμ νμ΄νλΌμΈμ μμ±ν©λλ€. | |
sentiment_pipeline = pipeline("sentiment-analysis") | |
def analyze_sentiment(text): | |
# μ λ ₯λ ν μ€νΈμ λν κ°μ λΆμμ μνν©λλ€. | |
result = sentiment_pipeline(text) | |
# λΆμ κ²°κ³Όλ₯Ό λ°νν©λλ€. | |
return result[0] | |
# Gradio μΈν°νμ΄μ€λ₯Ό μμ±ν©λλ€. | |
interface = gr.Interface(fn=analyze_sentiment, | |
inputs=gr.Textbox(lines=2, placeholder="Enter Text Here..."), | |
outputs="json", | |
title="Text Sentiment Analysis", | |
description="Enter a piece of text to analyze its sentiment. The model will classify it as positive or negative.") | |
# μ±μ μ€νν©λλ€. | |
if __name__ == "__main__": | |
interface.launch() |