reab5555 commited on
Commit
0a8dc2e
·
verified ·
1 Parent(s): 86a27b7

Update processing.py

Browse files
Files changed (1) hide show
  1. processing.py +9 -2
processing.py CHANGED
@@ -96,8 +96,15 @@ Analysis:"""
96
  print("\n" + "-"*50 + "\n") # Separator for readability
97
 
98
  try:
99
- # Parse the JSON directly from the response content
100
- parsed_json = json.loads(response.content)
 
 
 
 
 
 
 
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))