Daraphan's picture
Create app.py
5b456da verified
raw
history blame contribute delete
609 Bytes
import gradio as gr
from transformers import pipeline
# โหลดโมเดล
classifier = pipeline("text-classification", model="ongaunjie/distilbert-cloths-sentiment")
# ฟังก์ชันสำหรับการวิเคราะห์รีวิว
def analyze_sentiment(text):
return classifier(text)
# สร้าง UI ด้วย Gradio
iface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="json",
title="Clothing Sentiment Analyzer",
description="Analyze the sentiment of clothing product reviews.")
iface.launch()