Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -94,7 +94,7 @@ def extract_json_from_answer(answer, image_analysis):
|
|
94 |
end_idx = answer.rfind('}')
|
95 |
if start_idx != -1 and end_idx != 0:
|
96 |
json_str = answer[start_idx:end_idx]
|
97 |
-
json_str += f"image_analysis: ['prediction': {image_analysis['prediction']}, 'confidence': {image_analysis['confidence']}%.]"
|
98 |
return json.loads(json_str)
|
99 |
except (json.JSONDecodeError, ValueError):
|
100 |
logger.error("Failed to parse JSON from response")
|
|
|
94 |
end_idx = answer.rfind('}')
|
95 |
if start_idx != -1 and end_idx != 0:
|
96 |
json_str = answer[start_idx:end_idx]
|
97 |
+
json_str += f",image_analysis: ['prediction': {image_analysis['prediction']}, 'confidence': {image_analysis['confidence']}%.]"
|
98 |
return json.loads(json_str)
|
99 |
except (json.JSONDecodeError, ValueError):
|
100 |
logger.error("Failed to parse JSON from response")
|