Iltyas commited on
Commit
deb6cc5
·
verified ·
1 Parent(s): 3cfcb02

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
+ pipe = pipeline("text-classification", model="roberta-base-openai-detector")
6
+
7
+ def analyze(text):
8
+ if not text: return "دخل شي نص أولا"
9
+ res = pipe(text[:512])[0]
10
+ return f"النتيجة: {res['label']} (الدقة: {res['score']:.2f})"
11
+
12
+ # واجهة البرنامج
13
+ demo = gr.Interface(fn=analyze, inputs="text", outputs="text", title="كاشف الذكاء الاصطناعي")
14
+ demo.launch()