mtyrrell commited on
Commit
5d23ddc
1 Parent(s): b125eed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -25
app.py CHANGED
@@ -3,35 +3,35 @@ import os
3
  import pkg_resources
4
 
5
  # # Using this wacky hack to get around the massively ridicolous managed env loading order
6
- # def is_installed(package_name, version):
7
- # try:
8
- # pkg = pkg_resources.get_distribution(package_name)
9
- # return pkg.version == version
10
- # except pkg_resources.DistributionNotFound:
11
- # return False
12
-
13
- # # shifted from below - this must be the first streamlit call; otherwise: problems
14
- # st.set_page_config(page_title = 'Vulnerability Analysis',
15
- # initial_sidebar_state='expanded', layout="wide")
16
 
17
- # @st.cache_resource # cache the function so it's not called every time app.py is triggered
18
- # def install_packages():
19
- # install_commands = []
20
 
21
- # if not is_installed("spaces", "0.12.0"):
22
- # install_commands.append("pip install spaces==0.17.0")
23
 
24
- # if not is_installed("pydantic", "1.8.2"):
25
- # install_commands.append("pip install pydantic==1.8.2")
26
 
27
- # if not is_installed("typer", "0.4.0"):
28
- # install_commands.append("pip install typer==0.4.0")
29
 
30
- # if install_commands:
31
- # os.system(" && ".join(install_commands))
32
 
33
- # # install packages if necessary
34
- # install_packages()
35
 
36
  import appStore.vulnerability_analysis as vulnerability_analysis
37
  import appStore.target as target_analysis
@@ -41,8 +41,8 @@ from utils.vulnerability_classifier import label_dict
41
  import pandas as pd
42
  import plotly.express as px
43
 
44
- st.set_page_config(page_title = 'Vulnerability Analysis',
45
- initial_sidebar_state='expanded', layout="wide")
46
 
47
  with st.sidebar:
48
  # upload and example doc
 
3
  import pkg_resources
4
 
5
  # # Using this wacky hack to get around the massively ridicolous managed env loading order
6
+ def is_installed(package_name, version):
7
+ try:
8
+ pkg = pkg_resources.get_distribution(package_name)
9
+ return pkg.version == version
10
+ except pkg_resources.DistributionNotFound:
11
+ return False
12
+
13
+ # shifted from below - this must be the first streamlit call; otherwise: problems
14
+ st.set_page_config(page_title = 'Vulnerability Analysis',
15
+ initial_sidebar_state='expanded', layout="wide")
16
 
17
+ @st.cache_resource # cache the function so it's not called every time app.py is triggered
18
+ def install_packages():
19
+ install_commands = []
20
 
21
+ if not is_installed("spaces", "0.12.0"):
22
+ install_commands.append("pip install spaces==0.17.0")
23
 
24
+ if not is_installed("pydantic", "1.8.2"):
25
+ install_commands.append("pip install pydantic==1.8.2")
26
 
27
+ if not is_installed("typer", "0.4.0"):
28
+ install_commands.append("pip install typer==0.4.0")
29
 
30
+ if install_commands:
31
+ os.system(" && ".join(install_commands))
32
 
33
+ # install packages if necessary
34
+ install_packages()
35
 
36
  import appStore.vulnerability_analysis as vulnerability_analysis
37
  import appStore.target as target_analysis
 
41
  import pandas as pd
42
  import plotly.express as px
43
 
44
+ # st.set_page_config(page_title = 'Vulnerability Analysis',
45
+ # initial_sidebar_state='expanded', layout="wide")
46
 
47
  with st.sidebar:
48
  # upload and example doc