yashbyname commited on
Commit
3df9cbe
·
verified ·
1 Parent(s): 9639015

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -108,9 +108,20 @@ def process_image(image):
108
  def gradio_interface(patient_info, query_type, image):
109
  if image is not None:
110
  image_response = process_image(image)
 
 
111
  session_id = create_chat_session()
112
- llm_response = submit_query(session_id, f"Patient Info: {patient_info}. Query Type: {query_type}.")
113
- return f"Patient Info: {patient_info}\nQuery Type: {query_type}\n\n{image_response}\n\nLLM Response:\n{llm_response['data']['message']}"
 
 
 
 
 
 
 
 
 
114
  else:
115
  return "Please upload an image."
116
 
 
108
  def gradio_interface(patient_info, query_type, image):
109
  if image is not None:
110
  image_response = process_image(image)
111
+
112
+ # Call LLM with patient info and query
113
  session_id = create_chat_session()
114
+ query = f"Patient Info: {patient_info}\nQuery Type: {query_type}"
115
+ llm_response = submit_query(session_id, query)
116
+
117
+ # Debug: Print the full response to inspect it
118
+ print("LLM Response:", llm_response)
119
+
120
+ # Handle missing 'message' field safely
121
+ message = llm_response.get('data', {}).get('message', 'No message returned from LLM')
122
+
123
+ response = f"Patient Info: {patient_info}\nQuery Type: {query_type}\n\n{image_response}\n\nLLM Response:\n{message}"
124
+ return response
125
  else:
126
  return "Please upload an image."
127