rexarski commited on
Commit
08a5a4d
1 Parent(s): 9cc9f38

[FIX, REFACTOR] fix duplicate id issue of buttons

Browse files
Files changed (1) hide show
  1. app.py +19 -18
app.py CHANGED
@@ -161,22 +161,22 @@ if factchecking_demo == "Preloaded examples":
161
  ex_claim = selected_row1["claim"].values[0]
162
  ex_evidence = selected_row1["evidence"].values[0]
163
  ex_label = selected_row1["label"].values[0]
164
- if st.button("Run"):
165
  ex_pred = factcheck(
166
  selected_row1["claim"].values[0],
167
  selected_row1["evidence"].values[0],
168
  )
169
- st.markdown(f"**Claim**: {ex_claim}")
170
- st.markdown(f"**Evidence**: {ex_evidence}")
171
- st.markdown(f"**Label**: {ex_label}")
172
- st.markdown(
173
- f'**Prediction**: {ex_pred} {get_pred_emoji(ex_label, ex_pred, mode="factcheck")}'
174
- )
175
  else:
176
  st.markdown("Or enter your own claim and evidence below:")
177
  custom_claim = st.text_input(label="Enter your claim.")
178
  custom_evidence = st.text_input(label="Enter your evidence.")
179
- if st.button("Run"):
180
  if custom_claim != "" and custom_evidence != "":
181
  st.markdown(
182
  f"**Prediction**: {factcheck(custom_claim, custom_evidence)}"
@@ -200,25 +200,26 @@ if tcfd_demo == "Preloaded examples":
200
 
201
  ex_text = selected_row2["text"].values[0]
202
  ex_label2 = selected_row2["label"].values[0]
203
- if st.button('Run'):
204
  ex_pred2 = tcfd_classify(selected_row2["text"].values[0])
205
-
206
- st.markdown(f"**Text**: {ex_text}")
207
- st.markdown(f"**Label**: {ex_label2}")
208
- st.markdown(
209
- f'**Prediction**: {ex_pred2} {get_pred_emoji(ex_label2, ex_pred2, mode="tcfd")}'
210
- )
211
  else:
212
  st.markdown(
213
  "Or enter your own sentence to see if it belongs to any specific TCFD disclosure category:"
214
  )
215
  custom_text = st.text_input(label="Enter your text.")
216
- if st.button("Run"):
217
  if custom_text != "":
218
  st.markdown(f"**Prediction**: {tcfd_classify(custom_text)}")
219
 
220
- st.markdown("""
 
221
  ---
222
 
223
  🌦️
224
- """)
 
 
161
  ex_claim = selected_row1["claim"].values[0]
162
  ex_evidence = selected_row1["evidence"].values[0]
163
  ex_label = selected_row1["label"].values[0]
164
+ if st.button("Run", key="run1"):
165
  ex_pred = factcheck(
166
  selected_row1["claim"].values[0],
167
  selected_row1["evidence"].values[0],
168
  )
169
+ st.markdown(f"**Claim**: {ex_claim}")
170
+ st.markdown(f"**Evidence**: {ex_evidence}")
171
+ st.markdown(f"**Label**: {ex_label}")
172
+ st.markdown(
173
+ f'**Prediction**: {ex_pred} {get_pred_emoji(ex_label, ex_pred, mode="factcheck")}'
174
+ )
175
  else:
176
  st.markdown("Or enter your own claim and evidence below:")
177
  custom_claim = st.text_input(label="Enter your claim.")
178
  custom_evidence = st.text_input(label="Enter your evidence.")
179
+ if st.button("Run", key="run2"):
180
  if custom_claim != "" and custom_evidence != "":
181
  st.markdown(
182
  f"**Prediction**: {factcheck(custom_claim, custom_evidence)}"
 
200
 
201
  ex_text = selected_row2["text"].values[0]
202
  ex_label2 = selected_row2["label"].values[0]
203
+ if st.button("Run", key="run3"):
204
  ex_pred2 = tcfd_classify(selected_row2["text"].values[0])
205
+ st.markdown(f"**Text**: {ex_text}")
206
+ st.markdown(f"**Label**: {ex_label2}")
207
+ st.markdown(
208
+ f'**Prediction**: {ex_pred2} {get_pred_emoji(ex_label2, ex_pred2, mode="tcfd")}'
209
+ )
 
210
  else:
211
  st.markdown(
212
  "Or enter your own sentence to see if it belongs to any specific TCFD disclosure category:"
213
  )
214
  custom_text = st.text_input(label="Enter your text.")
215
+ if st.button("Run", key="run4"):
216
  if custom_text != "":
217
  st.markdown(f"**Prediction**: {tcfd_classify(custom_text)}")
218
 
219
+ st.markdown(
220
+ """
221
  ---
222
 
223
  🌦️
224
+ """
225
+ )