| import gradio as gr |
| from transformers import pipeline |
| from PIL import Image |
|
|
| |
| detector_nass = pipeline("text-classification", model="roberta-base-openai-detector") |
| detector_sora = pipeline("image-classification", model="umm-maybe/AI-image-detector") |
|
|
| def fahs_al_nass(nass): |
| if not nass: return "الرجاء إدخال النص المراد فحصه" |
| res = detector_nass(nass[:512])[0] |
| label = "بشري" if res['label'] == 'Real' else "ذكاء اصطناعي" |
| return f"النتيجة: {label} (الدقة: {res['score']:.2f})" |
|
|
| def fahs_al_sora(sora): |
| if sora is None: return "الرجاء تحميل صورة للفحص" |
| res = detector_sora(sora)[0] |
| label = "حقيقية" if res['label'] == 'Human' else "ذكاء اصطناعي" |
| return f"النتيجة: {label} (الدقة: {res['score']:.2f})" |
|
|
| def fahs_al_rabit(rabit): |
| if not rabit: return "الرجاء إدخال الرابط" |
| return "هذه الميزة (فحص الروابط) قيد التطوير حالياً" |
|
|
| |
| مع = gr.Blocks(css="body { direction: rtl; text-align: right; }") |
| with مع as demo: |
| gr.Markdown("# 🔍 منصة توارك للكشف الذكي") |
| gr.Markdown("مرحباً بك في المنصة الشاملة لكشف محتوى الذكاء الاصطناعي.") |
| |
| with gr.Tab("📝 فحص النصوص"): |
| input_nass = gr.Textbox(label="أدخل النص هنا", placeholder="اكتب أو الصق النص هنا...") |
| output_nass = gr.Label(label="نتيجة التحليل") |
| btn_nass = gr.Button("بدء عملية الفحص") |
| btn_nass.click(fahs_al_nass, inputs=input_nass, outputs=output_nass) |
| |
| with gr.Tab("🖼️ فحص الصور"): |
| input_sora = gr.Image(type="pil", label="قم برفع الصورة") |
| output_sora = gr.Label(label="نتيجة التحليل") |
| btn_sora = gr.Button("تحليل الصورة") |
| btn_sora.click(fahs_al_sora, inputs=input_sora, outputs=output_sora) |
| |
| with gr.Tab("🔗 فحص الروابط"): |
| input_rabit = gr.Textbox(label="أدخل رابط الموقع (URL)") |
| output_rabit = gr.Textbox(label="حالة الرابط") |
| btn_rabit = gr.Button("التحقق من الرابط") |
| btn_rabit.click(fahs_al_rabit, inputs=input_rabit, outputs=output_rabit) |
|
|
| demo.launch() |
|
|