UI fix
Browse files- appStore/target.py +12 -4
appStore/target.py
CHANGED
|
@@ -85,6 +85,12 @@ def target_display():
|
|
| 85 |
if 'key1' in st.session_state:
|
| 86 |
df = st.session_state.key1
|
| 87 |
hits = df[df['Target Label'] == 'TARGET']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
range_val = min(5,len(hits))
|
| 89 |
if range_val !=0:
|
| 90 |
count_target = sum(hits['Target Label'] == 'TARGET')
|
|
@@ -117,7 +123,7 @@ def target_display():
|
|
| 117 |
hits = hits.sort_values(by=['Relevancy'], ascending=False)
|
| 118 |
netzerohit = hits[hits['Netzero Label'] == 'NETZERO']
|
| 119 |
if not netzerohit.empty:
|
| 120 |
-
|
| 121 |
st.markdown("###### Netzero paragraph ######")
|
| 122 |
st.write('** Text `page {}`: {}'.format(netzerohit.iloc[i]['page'],
|
| 123 |
netzerohit.iloc[i]['text'].replace("\n", " ")))
|
|
@@ -132,10 +138,12 @@ def target_display():
|
|
| 132 |
# the page number reflects the page that contains the main paragraph
|
| 133 |
# according to split limit, the overlapping part can be on a separate page
|
| 134 |
st.write('**Result {}** (Relevancy Score: {:.2f}): `page {}`, `Sector: {}`,\
|
| 135 |
-
`GHG
|
| 136 |
.format(i+1,hits.iloc[i]['Relevancy'],
|
| 137 |
-
hits.iloc[i]['page'], hits.iloc[i]['Sector Label']
|
| 138 |
-
))
|
| 139 |
st.write("\t Text: \t{}".format(hits.iloc[i]['text'].replace("\n", " ")))
|
|
|
|
|
|
|
| 140 |
else:
|
| 141 |
st.info("🤔 No Targets found")
|
|
|
|
| 85 |
if 'key1' in st.session_state:
|
| 86 |
df = st.session_state.key1
|
| 87 |
hits = df[df['Target Label'] == 'TARGET']
|
| 88 |
+
_lab_dict = {
|
| 89 |
+
'LABEL_0':'NEGATIVE',
|
| 90 |
+
'LABEL_1':'NOT GHG',
|
| 91 |
+
'LABEL_2':'GHG',
|
| 92 |
+
}
|
| 93 |
+
hits['GHG Label'] = hits['GHG Label'].apply(lambda i: _lab_dict[i])
|
| 94 |
range_val = min(5,len(hits))
|
| 95 |
if range_val !=0:
|
| 96 |
count_target = sum(hits['Target Label'] == 'TARGET')
|
|
|
|
| 123 |
hits = hits.sort_values(by=['Relevancy'], ascending=False)
|
| 124 |
netzerohit = hits[hits['Netzero Label'] == 'NETZERO']
|
| 125 |
if not netzerohit.empty:
|
| 126 |
+
netzerohit = netzerohit.sort_values(by = ['Netzero Score'], ascending = False)
|
| 127 |
st.markdown("###### Netzero paragraph ######")
|
| 128 |
st.write('** Text `page {}`: {}'.format(netzerohit.iloc[i]['page'],
|
| 129 |
netzerohit.iloc[i]['text'].replace("\n", " ")))
|
|
|
|
| 138 |
# the page number reflects the page that contains the main paragraph
|
| 139 |
# according to split limit, the overlapping part can be on a separate page
|
| 140 |
st.write('**Result {}** (Relevancy Score: {:.2f}): `page {}`, `Sector: {}`,\
|
| 141 |
+
`GHG: {}`, `Adapt-Mitig :{}`'\
|
| 142 |
.format(i+1,hits.iloc[i]['Relevancy'],
|
| 143 |
+
hits.iloc[i]['page'], hits.iloc[i]['Sector Label'],
|
| 144 |
+
hits.iloc[i]['GHG Label'],hits.iloc[i]['Adapt-Mitig Label']))
|
| 145 |
st.write("\t Text: \t{}".format(hits.iloc[i]['text'].replace("\n", " ")))
|
| 146 |
+
hits = hits.reset_index(drop =True)
|
| 147 |
+
st.write(hits)
|
| 148 |
else:
|
| 149 |
st.info("🤔 No Targets found")
|