Spaces:
Build error
Build error
File size: 645 Bytes
e7e99ef 13dcfdb 45de567 e7e99ef 692c4cf e7e99ef |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
############### Tích hợp model từ Hub ###############
from transformers import pipeline
import gradio as gr
classifier = pipeline(
model="lxyuan/distilbert-base-multilingual-cased-sentiments-student",
top_k=None,
framework="pt"
)
############### Tạo giao diện ###############
def predict(text):
predictions = classifier(text)[0]
result = {pred['label']: pred['score'] for pred in predictions}
return result
demo = gr.Interface(
fn=predict,
inputs="text",
outputs="label",
title="Sentiment Analysis App",
description="Phân tích cảm xúc bằng mô hình DistillBERT"
)
demo.launch() |