ppsingh commited on
Commit
4e180de
1 Parent(s): c4c5777

update requirements

Browse files
Files changed (2) hide show
  1. app.py +21 -23
  2. pre-requirements.txt +1 -0
app.py CHANGED
@@ -3,34 +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
 
 
 
 
15
 
16
- # @st.cache_resource # cache the function so it's not called every time app.py is triggered
17
- # def install_packages():
18
- # install_commands = []
19
-
20
- # if not is_installed("spaces", "0.12.0"):
21
- # install_commands.append("pip install spaces==0.17.0")
22
 
23
- # if not is_installed("pydantic", "1.8.2"):
24
- # install_commands.append("pip install pydantic==1.8.2")
25
 
26
- # if not is_installed("typer", "0.4.0"):
27
- # install_commands.append("pip install typer==0.4.0")
28
 
29
- # if install_commands:
30
- # os.system(" && ".join(install_commands))
31
 
32
- # # install packages if necessary
33
- # install_packages()
34
 
35
  import appStore.target as target_extraction
36
  import appStore.netzero as netzero
@@ -45,9 +46,6 @@ import appStore.doc_processing as processing
45
  from utils.uploadAndExample import add_upload
46
  from PIL import Image
47
 
48
- st.set_page_config(page_title = 'Climate Policy Intelligence',
49
- initial_sidebar_state='expanded', layout="wide")
50
-
51
 
52
  with st.sidebar:
53
  # 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 = 'Climate Policy Intelligence',
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.target as target_extraction
37
  import appStore.netzero as netzero
 
46
  from utils.uploadAndExample import add_upload
47
  from PIL import Image
48
 
 
 
 
49
 
50
  with st.sidebar:
51
  # upload and example doc
pre-requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ pip==23.3.1