cpv_test / app.py
leavoigt's picture
Update app.py
31b5a19
raw
history blame
5.51 kB
import appStore.vulnerability_analysis as vulnerability_analysis
#import appStore.netzero as netzero
#import appStore.sector as sector
#import appStore.adapmit as adapmit
#import appStore.ghg as ghg
#import appStore.policyaction as policyaction
#import appStore.conditional as conditional
#import appStore.indicator as indicator
import appStore.doc_processing as processing
from utils.uploadAndExample import add_upload
#rom PIL import Image
import streamlit as st
st.set_page_config(page_title = 'Vulnerability Analysis',
initial_sidebar_state='expanded', layout="wide")
with st.sidebar:
# upload and example doc
choice = st.sidebar.radio(label = 'Select the Document',
help = 'You can upload the document \
or else you can try a example document',
options = ('Upload Document', 'Try Example'),
horizontal = True)
add_upload(choice)
with st.container():
st.markdown("<h2 style='text-align: center; color: black;'> Vulnerability Analysis </h2>", unsafe_allow_html=True)
st.write(' ')
with st.expander("ℹ️ - About this app", expanded=False):
st.write(
"""
The Vulnerability Analysis App is an open-source\
digital tool which aims to assist policy analysts and \
other users in extracting and filtering relevant \
information related to different vulnerable groups from public documents.
""")
# st.write('**Definitions**')
# st.caption("""
# - **Target**: Targets are an intention to achieve a specific result, \
# for example, to reduce GHG emissions to a specific level \
# (a GHG target) or increase energy efficiency or renewable \
# energy to a specific level (a non-GHG target), typically by \
# a certain date.
# - **Economy-wide Target**: Certain Target are applicable \
# not at specific Sector level but are applicable at economic \
# wide scale.
# - **Netzero**: Identifies if its Netzero Target or not.
# - 'NET-ZERO': target_labels = ['T_Netzero','T_Netzero_C']
# - 'Non Netzero Target': target_labels_neg = ['T_Economy_C',
# 'T_Economy_Unc','T_Adaptation_C','T_Adaptation_Unc','T_Transport_C',
# 'T_Transport_O_C','T_Transport_O_Unc','T_Transport_Unc']
# - 'Others': Other Targets beside covered above
# - **GHG Target**: GHG targets refer to contributions framed as targeted \
# outcomes in GHG terms.
# - 'GHG': target_labels_ghg_yes = ['T_Transport_Unc','T_Transport_C']
# - 'NON GHG TRANSPORT TARGET': target_labels_ghg_no = ['T_Adaptation_Unc',\
# 'T_Adaptation_C', 'T_Transport_O_Unc', 'T_Transport_O_C']
# - 'OTHERS': Other Targets beside covered above.
# - **Conditionality**: An “unconditional contribution” is what countries \
# could implement without any conditions and based on their own \
# resources and capabilities. A “conditional contribution” is one \
# that countries would undertake if international means of support \
# are provided, or other conditions are met.
# - **Action**: Actions are an intention to implement specific means of \
# achieving GHG reductions, usually in forms of concrete projects.
# - **Policies and Plans**: Policies are domestic planning documents \
# such as policies, regulations or guidlines, and Plans are broader \
# than specific policies or actions, such as a general intention \
# to ‘improve efficiency’, ‘develop renewable energy’, etc. \
# The terms come from the World Bank's NDC platform and WRI's publication.
# """)
#c1, c2, c3 = st.columns([12,1,10])
#with c1:
# image = Image.open('docStore/img/flow.jpg')
# st.image(image)
#with c3:
st.write("""
What Happens in background?
- Step 1: Once the document is provided to app, it undergoes *Pre-processing*.\
In this step the document is broken into smaller paragraphs \
(based on word/sentence count).
- Step 2: The paragraphs are then fed to the **Vulnerability Classifier** which detects if
the paragraph contains any *Target* related information or not.
- Step 3: The paragraphs which are detected containing some reference \
to a vulnerable group are then fed to multiple classifier to enrich the
Information Extraction.
""")
st.write("")
apps = [vulnerability_analysis.app]
multiplier_val =1/len(apps)
if st.button("Analyze Document"):
prg = st.progress(0.0)
for i,func in enumerate(apps):
func()
prg.progress((i+1)*multiplier_val)
if 'key1' in st.session_state:
with st.sidebar:
topic = st.radio(
"Which category you want to explore?",
('Vulnerability')
if topic == 'Vulnerability':
target_extraction.vulnerability_display()
# elif topic == 'Action':
# policyaction.action_display()
# else:
# policyaction.policy_display()
st.write(st.session_state.key1)