prithivMLmods commited on
Commit
59a74e8
·
verified ·
1 Parent(s): 96f7759

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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')