Tonic commited on
Commit
2f101a3
1 Parent(s): ad65b09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -13
app.py CHANGED
@@ -328,21 +328,30 @@ def process_summary_with_openai(summary):
328
 
329
 
330
  def process_and_query(input_language=None,audio_input=None,image_input=None,text_input=None):
 
 
331
  try:
332
- text = ""
333
- if text_input is not None :
334
- # augment the prompt before feeding it to vectara
335
- text = "the user asks the following to his health adviser " + text
336
- # process audio
337
- if audio_input is not None :
338
- text += "\n"+process_speech(input_language,audio_input)
339
- # process image
340
- if image_input is not None :
341
- text += "\n"+process_image(image_input)
342
-
343
-
 
 
 
 
 
 
 
344
  # Use the text to query Vectara
345
- vectara_response_json = query_vectara(text)
346
 
347
  # Convert the Vectara response to Markdown
348
  markdown_output = convert_to_markdown(vectara_response_json)
 
328
 
329
 
330
  def process_and_query(input_language=None,audio_input=None,image_input=None,text_input=None):
331
+ # Initialize the combined text
332
+ combined_text = ""
333
  try:
334
+ # Initialize the combined text
335
+ combined_text = ""
336
+
337
+ # Process text input
338
+ if text_input is not None:
339
+ # Augment the prompt before feeding it to Vectara
340
+ combined_text = "the user asks the following to his health adviser: " + text_input
341
+
342
+ # Process audio input
343
+ if audio_input is not None:
344
+ audio_text = process_speech(input_language, audio_input)
345
+ combined_text += "\n" + audio_text
346
+
347
+ # Process image input
348
+ if image_input is not None:
349
+ # Use the current combined text (which includes the processed text input) for image processing
350
+ image_text = process_image(image_input, combined_text)
351
+ combined_text += "\n" + image_text
352
+
353
  # Use the text to query Vectara
354
+ vectara_response_json = query_vectara(combined_text)
355
 
356
  # Convert the Vectara response to Markdown
357
  markdown_output = convert_to_markdown(vectara_response_json)