File size: 402 Bytes
cf8314e
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr
from transformers import pipeline

# تحميل النموذج
classifier = pipeline("text-classification", model="distilbert-base-uncased")

# دالة لتصنيف النص
def classify_text(text):
    result = classifier(text)
    return result[0]['label']

# إنشاء واجهة مستخدم
iface = gr.Interface(fn=classify_text, inputs="text", outputs="text")
iface.launch()