Spaces:
Sleeping
Sleeping
Update utils/vulnerability_classifier.py
Browse files
utils/vulnerability_classifier.py
CHANGED
|
@@ -7,6 +7,7 @@ from utils.config import getconfig
|
|
| 7 |
from utils.preprocessing import processingpipeline
|
| 8 |
import streamlit as st
|
| 9 |
from transformers import pipeline
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
@st.cache_resource
|
|
@@ -42,10 +43,13 @@ def load_vulnerabilityClassifier(config_file:str = None, classifier_name:str = N
|
|
| 42 |
# task="text-classification",
|
| 43 |
# top_k = None)
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
return doc_classifier
|
| 51 |
|
|
|
|
| 7 |
from utils.preprocessing import processingpipeline
|
| 8 |
import streamlit as st
|
| 9 |
from transformers import pipeline
|
| 10 |
+
from setfit import SetFitModel
|
| 11 |
|
| 12 |
|
| 13 |
@st.cache_resource
|
|
|
|
| 43 |
# task="text-classification",
|
| 44 |
# top_k = None)
|
| 45 |
|
| 46 |
+
# # Download model from HF Hub
|
| 47 |
+
doc_classifier = SetFitModel.from_pretrained("leavoigt/vulnerable_groups")
|
| 48 |
+
|
| 49 |
+
# doc_classifier = pipeline("text-classification",
|
| 50 |
+
# model=classifier_name,
|
| 51 |
+
# return_all_scores=True,
|
| 52 |
+
# function_to_apply= "sigmoid")
|
| 53 |
|
| 54 |
return doc_classifier
|
| 55 |
|