Reshmarb commited on
Commit
5bff428
·
1 Parent(s): 98205e6
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -112,9 +112,7 @@ def chatbot_ui():
112
  # Layout for chatbot and input box alignment
113
  with gr.Row():
114
  with gr.Column(scale=3): # Main column for chatbot
115
- chatbot = gr.Chatbot(label=None, elem_id="chatbot").style(
116
- align_self_left=True, # Align bot's response to the left
117
- )
118
  user_input = gr.Textbox(
119
  label="Ask a health-related question",
120
  placeholder="Describe your symptoms...",
@@ -131,20 +129,20 @@ def chatbot_ui():
131
  def handle_submit(user_query, image, history):
132
  logger.info("User submitted a query.")
133
  response, audio = customLLMBot(user_query, image, history)
134
- return response, audio, "", history
135
 
136
  # Submit on pressing Enter key
137
  user_input.submit(
138
  handle_submit,
139
  inputs=[user_input, uploaded_image, chat_history],
140
- outputs=[chatbot, audio_output, user_input, chat_history],
141
  )
142
 
143
  # Submit on button click
144
  submit_btn.click(
145
  handle_submit,
146
  inputs=[user_input, uploaded_image, chat_history],
147
- outputs=[chatbot, audio_output, user_input, chat_history],
148
  )
149
 
150
  # Action for clearing all fields
 
112
  # Layout for chatbot and input box alignment
113
  with gr.Row():
114
  with gr.Column(scale=3): # Main column for chatbot
115
+ chatbot = gr.Chatbot(label="Responses", elem_id="chatbot")
 
 
116
  user_input = gr.Textbox(
117
  label="Ask a health-related question",
118
  placeholder="Describe your symptoms...",
 
129
  def handle_submit(user_query, image, history):
130
  logger.info("User submitted a query.")
131
  response, audio = customLLMBot(user_query, image, history)
132
+ return response, audio, None, history # Clear the image after submission
133
 
134
  # Submit on pressing Enter key
135
  user_input.submit(
136
  handle_submit,
137
  inputs=[user_input, uploaded_image, chat_history],
138
+ outputs=[chatbot, audio_output, uploaded_image, chat_history],
139
  )
140
 
141
  # Submit on button click
142
  submit_btn.click(
143
  handle_submit,
144
  inputs=[user_input, uploaded_image, chat_history],
145
+ outputs=[chatbot, audio_output, uploaded_image, chat_history],
146
  )
147
 
148
  # Action for clearing all fields