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 |
+
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()
|