ghostai1 commited on
Commit
6986bb0
·
verified ·
1 Parent(s): 2291ccd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -13
app.py CHANGED
@@ -142,7 +142,7 @@ def plot_metrics(metrics):
142
  return 'rag_plot.png'
143
 
144
  # Gradio interface with stacked buttons and single output
145
- def chat_interface(query):
146
  try:
147
  response, retrieved_faqs, metrics = rag_process(query)
148
  plot_path = plot_metrics(metrics)
@@ -238,25 +238,31 @@ with gr.Blocks(css=custom_css) as demo:
238
  gr.Markdown("# Customer Experience Bot Demo", elem_classes="text-center")
239
  gr.Markdown("Select a question to see the bot's response, retrieved FAQs, and call center data cleanup stats.", elem_classes="text-center")
240
 
 
 
 
 
 
 
 
241
  # Stacked buttons in a single column
242
  with gr.Column(elem_id="button-container"):
243
  for question in unique_questions:
244
  gr.Button(question).click(
245
  fn=chat_interface,
246
- inputs=gr.State(value=question),
 
 
 
 
 
 
247
  outputs=[
248
- gr.Textbox(label="Bot Response"),
249
- gr.Textbox(label="Retrieved FAQs"),
250
- gr.Textbox(label="Data Cleanup Stats"),
251
- gr.Image(label="RAG Pipeline Metrics")
252
  ]
253
  )
254
-
255
- # Single output panel
256
- with gr.Column(elem_id="output-container"):
257
- response_output = gr.Textbox(label="Bot Response")
258
- faq_output = gr.Textbox(label="Retrieved FAQs")
259
- cleanup_output = gr.Textbox(label="Data Cleanup Stats")
260
- plot_output = gr.Image(label="RAG Pipeline Metrics")
261
 
262
  demo.launch()
 
142
  return 'rag_plot.png'
143
 
144
  # Gradio interface with stacked buttons and single output
145
+ def chat_interface(query, response_output, faq_output, cleanup_output, plot_output):
146
  try:
147
  response, retrieved_faqs, metrics = rag_process(query)
148
  plot_path = plot_metrics(metrics)
 
238
  gr.Markdown("# Customer Experience Bot Demo", elem_classes="text-center")
239
  gr.Markdown("Select a question to see the bot's response, retrieved FAQs, and call center data cleanup stats.", elem_classes="text-center")
240
 
241
+ # Single output panel (defined once)
242
+ with gr.Column(elem_id="output-container"):
243
+ response_output = gr.Textbox(label="Bot Response")
244
+ faq_output = gr.Textbox(label="Retrieved FAQs")
245
+ cleanup_output = gr.Textbox(label="Data Cleanup Stats")
246
+ plot_output = gr.Image(label="RAG Pipeline Metrics")
247
+
248
  # Stacked buttons in a single column
249
  with gr.Column(elem_id="button-container"):
250
  for question in unique_questions:
251
  gr.Button(question).click(
252
  fn=chat_interface,
253
+ inputs=[
254
+ gr.State(value=question),
255
+ response_output,
256
+ faq_output,
257
+ cleanup_output,
258
+ plot_output
259
+ ],
260
  outputs=[
261
+ response_output,
262
+ faq_output,
263
+ cleanup_output,
264
+ plot_output
265
  ]
266
  )
 
 
 
 
 
 
 
267
 
268
  demo.launch()