xuandin commited on
Commit
5701a4f
·
verified ·
1 Parent(s): f345548

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -215,6 +215,7 @@ with st.container():
215
  verdict_start_time = time.time()
216
  verdict = "NEI"
217
  details = ""
 
218
  prob3class, pred_tc = classify_claim(
219
  claim, evidence, model_tc, tokenizer_tc,
220
  "cuda" if torch.cuda.is_available() else "cpu"
@@ -226,13 +227,13 @@ with st.container():
226
  )
227
  verdict = "SUPPORTED" if pred_bc == 0 else "REFUTED" if prob2class > prob3class else ["NEI", "SUPPORTED", "REFUTED"][pred_tc]
228
 
229
- if show_details:
230
- details = f"""
231
- <p><strong>3-Class Probability:</strong> {prob3class.item():.2f}</p>
232
- <p><strong>3-Class Predicted Label:</strong> {['NEI', 'SUPPORTED', 'REFUTED'][pred_tc]}</p>
233
- <p><strong>2-Class Probability:</strong> {prob2class.item():.2f}</p>
234
- <p><strong>2-Class Predicted Label:</strong> {['SUPPORTED', 'REFUTED'][pred_bc]}</p>
235
- """
236
  verdict_time = time.time() - verdict_start_time
237
 
238
  # Store verification history and the latest result
 
215
  verdict_start_time = time.time()
216
  verdict = "NEI"
217
  details = ""
218
+ prob2class, pred_bc = 0, "Not used"
219
  prob3class, pred_tc = classify_claim(
220
  claim, evidence, model_tc, tokenizer_tc,
221
  "cuda" if torch.cuda.is_available() else "cpu"
 
227
  )
228
  verdict = "SUPPORTED" if pred_bc == 0 else "REFUTED" if prob2class > prob3class else ["NEI", "SUPPORTED", "REFUTED"][pred_tc]
229
 
230
+ if show_details:
231
+ details = f"""
232
+ <p><strong>3-Class Probability:</strong> {prob3class.item():.2f}</p>
233
+ <p><strong>3-Class Predicted Label:</strong> {['NEI', 'SUPPORTED', 'REFUTED'][pred_tc]}</p>
234
+ <p><strong>2-Class Probability:</strong> {prob2class.item():.2f}</p>
235
+ <p><strong>2-Class Predicted Label:</strong> {['SUPPORTED', 'REFUTED'][pred_bc]}</p>
236
+ """
237
  verdict_time = time.time() - verdict_start_time
238
 
239
  # Store verification history and the latest result