Loren commited on
Commit
fbc3d86
·
1 Parent(s): c2cea14

Add examples

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -539,7 +539,7 @@ with gr.Blocks(title="FAQ Search", css=custom_css) as demo:
539
 
540
  # Header with logo and title
541
  with gr.Row():
542
- gr.HTML("<h1 style='text-align: left; font-weight: bold;'>Test search dans FAQ</h1>")
543
 
544
  with gr.Accordion("📃 Contenu de la FAQ", open=False):
545
  faq_content = get_faq()
@@ -548,6 +548,11 @@ with gr.Blocks(title="FAQ Search", css=custom_css) as demo:
548
  # User input query field
549
  sel_query = gr.Textbox(label="Query", scale=5)
550
 
 
 
 
 
 
551
  current_trace_id = gr.State()
552
  current_observation_id = gr.State()
553
 
@@ -594,6 +599,19 @@ with gr.Blocks(title="FAQ Search", css=custom_css) as demo:
594
  inputs=[sel_query, similarity_threshold, top_k, cross_encodeur_gap_threshold, cross_encodeur_confidence_threshold, chatbot],
595
  outputs=[chatbot, current_trace_id, current_observation_id, sel_query, view_candidates])
596
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  # Positive feedback button
598
  btn_like.click(positive_feedback,
599
  inputs=[current_trace_id, current_observation_id, feedback_comment],
 
539
 
540
  # Header with logo and title
541
  with gr.Row():
542
+ gr.HTML("<h1 style='text-align: left; font-weight: bold;'>Test et évaluation de la recherche dans la FAQ</h1>")
543
 
544
  with gr.Accordion("📃 Contenu de la FAQ", open=False):
545
  faq_content = get_faq()
 
548
  # User input query field
549
  sel_query = gr.Textbox(label="Query", scale=5)
550
 
551
+ with gr.Row():
552
+ gr.Markdown("Exemples :")
553
+ example_prerequis = gr.Button("y a-t-il des prérequis ?")
554
+ example_dispo = gr.Button("il faut avoir combien de dispo par semaine ?")
555
+
556
  current_trace_id = gr.State()
557
  current_observation_id = gr.State()
558
 
 
599
  inputs=[sel_query, similarity_threshold, top_k, cross_encodeur_gap_threshold, cross_encodeur_confidence_threshold, chatbot],
600
  outputs=[chatbot, current_trace_id, current_observation_id, sel_query, view_candidates])
601
 
602
+ for example_button, question in [
603
+ (example_prerequis, "y a-t-il des prérequis ?"),
604
+ (example_dispo, "il faut avoir combien de dispo par semaine ?"),
605
+ ]:
606
+ example_button.click(
607
+ fn=lambda value=question: value,
608
+ outputs=[sel_query],
609
+ ).then(
610
+ faq_pipeline,
611
+ inputs=[sel_query, similarity_threshold, top_k, cross_encodeur_gap_threshold, cross_encodeur_confidence_threshold, chatbot],
612
+ outputs=[chatbot, current_trace_id, current_observation_id, sel_query, view_candidates],
613
+ ).then(lambda: "", outputs=[sel_query])
614
+
615
  # Positive feedback button
616
  btn_like.click(positive_feedback,
617
  inputs=[current_trace_id, current_observation_id, feedback_comment],