Iker commited on
Commit
01991de
·
verified ·
1 Parent(s): 7ecec14

Upload compare_gradio.py

Browse files
Files changed (1) hide show
  1. compare_gradio.py +12 -4
compare_gradio.py CHANGED
@@ -112,7 +112,9 @@ def format_response(response):
112
  for q, a in rq.items():
113
  rq_block.append("**{}**\n{}".format(q, a))
114
 
115
- return "## {}\n\n### {}\n\n{}\n\n{}".format(title, main_claim, fc, "\n".join(rq_block))
 
 
116
 
117
 
118
  def do_both_fact_checking(msg):
@@ -140,8 +142,8 @@ def do_both_fact_checking(msg):
140
  thread.join()
141
 
142
  # Format the responses
143
- response_1 = format_response(results[0]) if results[0] else None
144
- response_2 = format_response(results[1]) if results[1] else None
145
  history_a = [(msg, response_1)]
146
  history_b = [(msg, response_2)]
147
  return ("", history_a, history_b, models)
@@ -190,6 +192,8 @@ def save_history(
190
 
191
  gr.Info("Feedback sent successfully! Thank you for your help.")
192
 
 
 
193
 
194
  with gr.Blocks(
195
  theme="gradio/soft",
@@ -256,6 +260,7 @@ with gr.Blocks(
256
  chatbot_a,
257
  chatbot_b,
258
  ],
 
259
  )
260
 
261
  tie.click(
@@ -268,6 +273,7 @@ with gr.Blocks(
268
  chatbot_a,
269
  chatbot_b,
270
  ],
 
271
  )
272
 
273
  fail.click(
@@ -280,6 +286,7 @@ with gr.Blocks(
280
  chatbot_a,
281
  chatbot_b,
282
  ],
 
283
  )
284
 
285
  right.click(
@@ -292,10 +299,11 @@ with gr.Blocks(
292
  chatbot_a,
293
  chatbot_b,
294
  ],
 
295
  )
296
 
297
  demo.load(update_models, inputs=[], outputs=[models])
298
 
299
  demo.launch(
300
- #auth=(os.getenv("GRADIO_USERNAME"), os.getenv("GRADIO_PASSWORD")),share=True
301
  )
 
112
  for q, a in rq.items():
113
  rq_block.append("**{}**\n{}".format(q, a))
114
 
115
+ return "## {}\n\n### {}\n\n{}\n\n{}".format(
116
+ title, main_claim, fc, "\n".join(rq_block)
117
+ )
118
 
119
 
120
  def do_both_fact_checking(msg):
 
142
  thread.join()
143
 
144
  # Format the responses
145
+ response_1 = format_response(results[0]) if results[0] else "Error"
146
+ response_2 = format_response(results[1]) if results[1] else "Error"
147
  history_a = [(msg, response_1)]
148
  history_b = [(msg, response_2)]
149
  return ("", history_a, history_b, models)
 
192
 
193
  gr.Info("Feedback sent successfully! Thank you for your help.")
194
 
195
+ return [], []
196
+
197
 
198
  with gr.Blocks(
199
  theme="gradio/soft",
 
260
  chatbot_a,
261
  chatbot_b,
262
  ],
263
+ outputs=[chatbot_a, chatbot_b],
264
  )
265
 
266
  tie.click(
 
273
  chatbot_a,
274
  chatbot_b,
275
  ],
276
+ outputs=[chatbot_a, chatbot_b],
277
  )
278
 
279
  fail.click(
 
286
  chatbot_a,
287
  chatbot_b,
288
  ],
289
+ outputs=[chatbot_a, chatbot_b],
290
  )
291
 
292
  right.click(
 
299
  chatbot_a,
300
  chatbot_b,
301
  ],
302
+ outputs=[chatbot_a, chatbot_b],
303
  )
304
 
305
  demo.load(update_models, inputs=[], outputs=[models])
306
 
307
  demo.launch(
308
+ # auth=(os.getenv("GRADIO_USERNAME"), os.getenv("GRADIO_PASSWORD")),share=True
309
  )