Update appStore/target.py
Browse files- appStore/target.py +38 -24
appStore/target.py
CHANGED
@@ -1,27 +1,41 @@
|
|
1 |
-
#
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
#
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
# # Declare all the necessary variables
|
27 |
# classifier_identifier = 'target'
|
|
|
1 |
+
# set path
|
2 |
+
import glob, os, sys;
|
3 |
+
sys.path.append('../utils')
|
4 |
+
|
5 |
+
#import needed libraries
|
6 |
+
import seaborn as sns
|
7 |
+
import matplotlib.pyplot as plt
|
8 |
+
import numpy as np
|
9 |
+
import pandas as pd
|
10 |
+
import streamlit as st
|
11 |
+
from utils.vulnerability_classifier import load_targetClassifier, target_classification
|
12 |
+
import logging
|
13 |
+
logger = logging.getLogger(__name__)
|
14 |
+
from utils.config import get_classifier_params
|
15 |
+
from utils.preprocessing import paraLengthCheck
|
16 |
+
from io import BytesIO
|
17 |
+
import xlsxwriter
|
18 |
+
import plotly.express as px
|
19 |
+
from utils.vulnerability_classifier import label_dict
|
20 |
+
|
21 |
+
|
22 |
+
def app():
|
23 |
+
### Main app code ###
|
24 |
+
with st.container():
|
25 |
+
|
26 |
+
if 'key1' in st.session_state:
|
27 |
+
|
28 |
+
# Load the existing dataset
|
29 |
+
df = st.session_state.key1
|
30 |
+
|
31 |
+
# Load the classifier model
|
32 |
+
classifier = load_targetClassifier(classifier_name=params['model_name'])
|
33 |
+
st.session_state['{}_classifier'.format(classifier_identifier)] = classifier
|
34 |
+
|
35 |
+
|
36 |
+
df = target_classification(haystack_doc=df,
|
37 |
+
threshold= params['threshold'])
|
38 |
+
st.session_state.key1 = df
|
39 |
|
40 |
# # Declare all the necessary variables
|
41 |
# classifier_identifier = 'target'
|