Spaces:
Sleeping
Sleeping
Download app.py from NikolaCu/fraud-detector: direct link, hf CLI and curl.
- Browser
- Download file 993 Bytes
-
https://huggingface.co/spaces/NikolaCu/fraud-detector/resolve/main/app.py
- Command line
-
hf download hf://spaces/NikolaCu/fraud-detector/app.py
-
curl -L -o app.py https://huggingface.co/spaces/NikolaCu/fraud-detector/resolve/main/app.py
993 Bytes
| import gradio as gr | |
| fraud_keywords = [ | |
| "brz profit", "uloži odmah", "laka zarada", "kliknite ovde", | |
| "bez rizika", "investicija iz snova", "zagarantovan dobitak" | |
| ] | |
| def detect_fraud(text): | |
| text_lower = text.lower() | |
| detected = [kw for kw in fraud_keywords if kw in text_lower] | |
| if detected: | |
| return ( | |
| "⚠️ Poruka je verovatno prevarnog karaktera.", | |
| f"Klasifikacija: PREVARA\nOtkriveni obrasci: {', '.join(detected)}" | |
| ) | |
| else: | |
| return ( | |
| "✅ Poruka ne sadrži očigledne obrasce prevare.", | |
| "Klasifikacija: BEZBEDNO" | |
| ) | |
| interface = gr.Interface( | |
| fn=detect_fraud, | |
| inputs=gr.Textbox(lines=5, label="Unesi poruku ili oglas"), | |
| outputs=[gr.Textbox(label="Rezultat"), gr.Textbox(label="Detalji analize")], | |
| title="AI Detektor Prevarnih Poruka", | |
| description="Analiza tekstualnih poruka i klasifikacija da li sadrže prepoznatljive obrasce internet prevara." | |
| ) | |
| interface.launch() | |