twoweeksgetheart commited on
Commit
9c4a2f9
·
verified ·
1 Parent(s): 5b3a74e

Загрузка модели обнаружения фишинговых сообщений

Browse files
Files changed (3) hide show
  1. README.md +6 -6
  2. app.py +33 -0
  3. requirements.txt +3 -0
README.md CHANGED
@@ -1,12 +1,12 @@
1
  ---
2
- title: Phishing Or Not Demo Rubert
3
- emoji: 🐠
4
- colorFrom: green
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 5.25.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Классификация фишинговых сообщений
3
+ colorFrom: blue
4
+ colorTO: yellow
 
5
  sdk: gradio
6
+ sdk_version: 5.9.1
7
  app_file: app.py
8
  pinned: false
9
+ licence: apache-2.0
10
  ---
11
 
12
+ Является ли сообщение фишинговым?
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+ from typing import Dict
4
+ from transformers import pipeline
5
+
6
+ def phishing_not_phishing_classifier(text:str) -> Dict[str, float]:
7
+ phishing_not_phishing_classifier_pipeline = pipeline(task="text-classification",
8
+ model="twoweeksgetheart/learn_hf_phishing_not_phishing_text_classifier_rubert",
9
+ batch_size=32,
10
+ device="cuda" if torch.cuda.is_available() else "cpu",
11
+ top_k=None)
12
+ outputs = phishing_not_phishing_classifier_pipeline(text)[0]
13
+
14
+ outpid_dict = {}
15
+ for item in outputs:
16
+ outpid_dict[item["label"]] = item["score"]
17
+
18
+ return outpid_dict
19
+
20
+ description = """
21
+ Является ли сообщение фишинговым?
22
+ """
23
+
24
+ demo = gr.Interface(
25
+ fn=phishing_not_phishing_classifier,
26
+ inputs="text",
27
+ outputs=gr.Label(num_top_classes=2),
28
+ title="Классификация фишинговых сообщений",
29
+ description=description,
30
+ )
31
+
32
+ if __name__ == "__main__":
33
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ torch
3
+ transformers