Gteam / app.py
MennatullahHany's picture
requirements.txt
4b08a93 verified
raw
history blame contribute delete
726 Bytes
import gradio as gr
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="MennatullahHany/Arabic-Speech-Guard",
tokenizer="MennatullahHany/Arabic-Speech-Guard",
return_all_scores=True
)
def predict(text):
if text.strip() == "":
return "❌ Please enter Arabic text"
results = classifier(text)[0]
output = ""
for r in results:
output += f"{r['label']}: {round(r['score']*100, 2)}%\n"
return output
demo = gr.Interface(
fn=predict,
inputs=gr.Textbox(lines=4, placeholder="اكتب النص هنا..."),
outputs="text",
title="Arabic Speech Guard 🛡️",
description="Detect offensive Arabic content"
)
demo.launch()