Spaces:
Runtime error
Runtime error
Update processing.py
Browse files- processing.py +9 -2
processing.py
CHANGED
@@ -96,8 +96,15 @@ Analysis:"""
|
|
96 |
print("\n" + "-"*50 + "\n") # Separator for readability
|
97 |
|
98 |
try:
|
99 |
-
#
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
print("Parsed JSON Output:")
|
103 |
print(json.dumps(parsed_json, indent=2))
|
|
|
96 |
print("\n" + "-"*50 + "\n") # Separator for readability
|
97 |
|
98 |
try:
|
99 |
+
# Remove code block markers if present
|
100 |
+
content = response.content
|
101 |
+
if content.startswith("```json"):
|
102 |
+
content = content.split("```json", 1)[1]
|
103 |
+
if content.endswith("```"):
|
104 |
+
content = content.rsplit("```", 1)[0]
|
105 |
+
|
106 |
+
# Parse the JSON
|
107 |
+
parsed_json = json.loads(content.strip())
|
108 |
|
109 |
print("Parsed JSON Output:")
|
110 |
print(json.dumps(parsed_json, indent=2))
|