Spaces:
Sleeping
Sleeping
File size: 853 Bytes
ec5aa0b |
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_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() |