Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def detect(text): | |
| # 模擬防禦邏輯 | |
| malicious_keywords = ["ignore", "system prompt", "secret", "override"] | |
| if any(key in text.lower() for key in malicious_keywords): | |
| return "⚠️ 偵測到潛在提示注入攻擊! (High Risk)" | |
| return "✅ 輸入語意安全 (Clean)" | |
| demo = gr.Interface( | |
| fn=detect, | |
| inputs=gr.Textbox(label="輸入待測 Prompt", placeholder="例如:Ignore previous instructions..."), | |
| outputs=gr.Textbox(label="防禦系統分析結果"), | |
| title="🛡️ PromptGuard RAG 防禦演示系統", | |
| description="本系統由 PromptGuard Research 開發,用於偵測檢索增強生成架構中的惡意指令注入。" | |
| ) | |
| demo.launch() |