Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
# Use the text to query Vectara
|
345 |
-
vectara_response_json = query_vectara(
|
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)
|