Spaces:
Sleeping
Sleeping
Update chat.py
Browse files
chat.py
CHANGED
@@ -341,11 +341,11 @@ def unstructured_text_to_df(text):
|
|
341 |
# Try to parse the response as JSON
|
342 |
try:
|
343 |
# Find the JSON-like section and load it
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
except (json.JSONDecodeError, ValueError) as e:
|
350 |
print(f"Error: {e}")
|
351 |
|
|
|
341 |
# Try to parse the response as JSON
|
342 |
try:
|
343 |
# Find the JSON-like section and load it
|
344 |
+
start_index = response_content.find("{")
|
345 |
+
json_part = response_content[start_index:] # Extract starting from the first '{'
|
346 |
+
structured_data = json.loads(json_part) # Parse the JSON part
|
347 |
+
|
348 |
+
print("Parsed JSON:", structured_data)
|
349 |
except (json.JSONDecodeError, ValueError) as e:
|
350 |
print(f"Error: {e}")
|
351 |
|