KEYWORD / app.py
Mohzen321's picture
Create app.py
cf8314e verified
raw
history blame
402 Bytes
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()