vinzur commited on
Commit
a14fe5c
·
verified ·
1 Parent(s): 499f5be

Update references format

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -97,7 +97,7 @@ def handle_query(text_input, image_input):
97
 
98
  answer = response.choices[0].message.content
99
  references = "\n".join([
100
- f"{chunk['file']} | Page {chunk['page']} | Type: {chunk['type']} | Score: {chunk['score']:.2f}"
101
  for chunk in chunks
102
  ])
103
 
@@ -107,13 +107,19 @@ def handle_query(text_input, image_input):
107
  def launch_app():
108
  with gr.Blocks() as demo:
109
  gr.Markdown("## 📄🎓Multimodal Chatbot for FAST-NUCES")
 
110
  with gr.Row():
111
  text_input = gr.Textbox(label="Enter your query")
112
  image_input = gr.Image(label="Upload an image", type="pil")
 
113
  with gr.Row():
114
  btn = gr.Button("Submit")
115
- answer_output = gr.Markdown(label="Response")
116
- reference_output = gr.Textbox(label="Source References", lines=6)
 
 
 
 
117
 
118
  btn.click(fn=handle_query, inputs=[text_input, image_input], outputs=[answer_output, reference_output])
119
 
 
97
 
98
  answer = response.choices[0].message.content
99
  references = "\n".join([
100
+ f"- **{chunk['file']}** | Page {chunk['page']} | Type: *{chunk['type']}* | Score: `{chunk['score']:.2f}`"
101
  for chunk in chunks
102
  ])
103
 
 
107
  def launch_app():
108
  with gr.Blocks() as demo:
109
  gr.Markdown("## 📄🎓Multimodal Chatbot for FAST-NUCES")
110
+
111
  with gr.Row():
112
  text_input = gr.Textbox(label="Enter your query")
113
  image_input = gr.Image(label="Upload an image", type="pil")
114
+
115
  with gr.Row():
116
  btn = gr.Button("Submit")
117
+
118
+ gr.Markdown("### 🧠 LLM Response:")
119
+ answer_output = gr.Markdown()
120
+
121
+ with gr.Accordion("📚 Source References", open=False):
122
+ reference_output = gr.Markdown()
123
 
124
  btn.click(fn=handle_query, inputs=[text_input, image_input], outputs=[answer_output, reference_output])
125