import gradio as gr from transformers import pipeline import os model_path = "d12o6aa/ArabGuard" classifier = pipeline("text-classification", model=model_path) def predict(text, request: gr.Request): results = classifier(text)[0] return {"label": results['label'], "confidence": round(results['score'], 4)} demo = gr.Interface( fn=predict, inputs=gr.Textbox(label="Input Text (Slang/Franco)"), outputs=gr.JSON(label="Security Analysis"), title="ArabGuard API Gateway", description="Secure API for detecting Prompt Injections in Egyptian Dialect." ) if __name__ == "__main__": demo.launch()