not-lain commited on
Commit
4d5d42b
1 Parent(s): 3ca6a7a

MAJOR CHANGES

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -86,7 +86,7 @@ def process_image(image) :
86
  out = response.json()
87
  out = out["choices"][0]["message"]["content"]
88
 
89
- return f"{out}"
90
  except Exception as e :
91
  return f"{e}"
92
 
@@ -221,16 +221,14 @@ def convert_to_markdown(vectara_response_json):
221
 
222
  def process_and_query(text=None, image=None, audio=None):
223
  try:
224
- print(f"text_value : {text}")
225
  # If an image is provided, process it with OpenAI and use the response as the text query for Vectara
226
  if image is not None:
227
  text = process_image(image)
228
- print("audio_value is : ", audio)
229
  if audio is not None:
230
  text = process_speech(audio)
231
- # this should print in the log the text that was extracted from the audio
232
- print("process_speech_out : ", text)
233
-
234
  # Now, use the text (either provided by the user or obtained from OpenAI) to query Vectara
235
  vectara_response_json = query_vectara(text)
236
  markdown_output = convert_to_markdown(vectara_response_json)
 
86
  out = response.json()
87
  out = out["choices"][0]["message"]["content"]
88
 
89
+ return out
90
  except Exception as e :
91
  return f"{e}"
92
 
 
221
 
222
  def process_and_query(text=None, image=None, audio=None):
223
  try:
 
224
  # If an image is provided, process it with OpenAI and use the response as the text query for Vectara
225
  if image is not None:
226
  text = process_image(image)
 
227
  if audio is not None:
228
  text = process_speech(audio)
229
+
230
+ # augment the prompt before feeding it to vectara
231
+ text = "the user asks the following to his health adviser " + text
232
  # Now, use the text (either provided by the user or obtained from OpenAI) to query Vectara
233
  vectara_response_json = query_vectara(text)
234
  markdown_output = convert_to_markdown(vectara_response_json)