Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# تحميل النموذج
|
5 |
+
classifier = pipeline("text-classification", model="distilbert-base-uncased")
|
6 |
+
|
7 |
+
# دالة لتصنيف النص
|
8 |
+
def classify_text(text):
|
9 |
+
result = classifier(text)
|
10 |
+
return result[0]['label']
|
11 |
+
|
12 |
+
# إنشاء واجهة مستخدم
|
13 |
+
iface = gr.Interface(fn=classify_text, inputs="text", outputs="text")
|
14 |
+
iface.launch()
|