Mohzen321 commited on
Commit
cf8314e
·
verified ·
1 Parent(s): 85a48c7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
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()