leavoigt commited on
Commit
dbd62d7
1 Parent(s): 36011ef

Update appStore/target.py

Browse files
Files changed (1) hide show
  1. appStore/target.py +33 -0
appStore/target.py CHANGED
@@ -18,6 +18,39 @@ import xlsxwriter
18
  import plotly.express as px
19
  from utils.target_classifier import label_dict
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  def app():
23
  ### Main app code ###
 
18
  import plotly.express as px
19
  from utils.target_classifier import label_dict
20
 
21
+ # Declare all the necessary variables
22
+ classifier_identifier = 'vulnerability'
23
+ params = get_classifier_params(classifier_identifier)
24
+
25
+ @st.cache_data
26
+ def to_excel(df,sectorlist):
27
+ len_df = len(df)
28
+ output = BytesIO()
29
+ writer = pd.ExcelWriter(output, engine='xlsxwriter')
30
+ df.to_excel(writer, index=False, sheet_name='Sheet1')
31
+ workbook = writer.book
32
+ worksheet = writer.sheets['Sheet1']
33
+ worksheet.data_validation('S2:S{}'.format(len_df),
34
+ {'validate': 'list',
35
+ 'source': ['No', 'Yes', 'Discard']})
36
+ worksheet.data_validation('X2:X{}'.format(len_df),
37
+ {'validate': 'list',
38
+ 'source': sectorlist + ['Blank']})
39
+ worksheet.data_validation('T2:T{}'.format(len_df),
40
+ {'validate': 'list',
41
+ 'source': sectorlist + ['Blank']})
42
+ worksheet.data_validation('U2:U{}'.format(len_df),
43
+ {'validate': 'list',
44
+ 'source': sectorlist + ['Blank']})
45
+ worksheet.data_validation('V2:V{}'.format(len_df),
46
+ {'validate': 'list',
47
+ 'source': sectorlist + ['Blank']})
48
+ worksheet.data_validation('W2:U{}'.format(len_df),
49
+ {'validate': 'list',
50
+ 'source': sectorlist + ['Blank']})
51
+ writer.save()
52
+ processed_data = output.getvalue()
53
+ return processed_data
54
 
55
  def app():
56
  ### Main app code ###