Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -294,10 +294,11 @@ def process_image(
|
|
294 |
buffer = raw_output
|
295 |
result['raw_output'] = buffer
|
296 |
yield result
|
297 |
-
try:
|
298 |
-
json_match = re.search(r'```json
|
299 |
json_str = json_match.group(1) if json_match else buffer
|
300 |
-
layout_data = json.loads(json_str)
|
|
|
301 |
result['layout_result'] = layout_data
|
302 |
try:
|
303 |
markdown_content = layoutjson2md(image, layout_data, text_key='text')
|
|
|
294 |
buffer = raw_output
|
295 |
result['raw_output'] = buffer
|
296 |
yield result
|
297 |
+
try:
|
298 |
+
json_match = re.search(r'```json\s*([\s\S]+?)\s*```', buffer)
|
299 |
json_str = json_match.group(1) if json_match else buffer
|
300 |
+
layout_data = json.loads(json_str)
|
301 |
+
|
302 |
result['layout_result'] = layout_data
|
303 |
try:
|
304 |
markdown_content = layoutjson2md(image, layout_data, text_key='text')
|