Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|