Spaces:
Build error
Build error
Update chat.py
Browse files340 unmodified lines341342343344345346347348344345346347348349350351340 unmodified lines # Try to parse the response as JSON try: # Find the JSON-like section and load it start_index = response_content.find("{") json_part = response_content[start_index:] # Extract starting from the first '{' structured_data = json.loads(json_part) # Parse the JSON part
print("Parsed JSON:", structured_data) start_index = response_content.find("{") json_part = response_content[start_index:] # Extract starting from the first '{' structured_data = json.loads(json_part) # Parse the JSON part print("Parsed JSON:", structured_data) except (json.JSONDecodeError, ValueError) as e: print(f"Error: {e}") chat.py+5-5