odrec commited on
Commit
b94b14f
·
verified ·
1 Parent(s): de66793

Fix missing tab after first exception

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -42,16 +42,16 @@ def ocr_pdf_img_document(pdf_or_img_url:str)-> str:
42
  }
43
  )
44
  except Exception:
45
- try: # IF PDF OCR fails, try Image OCR
46
- ocr_response = client.ocr.process(
47
- model=ocr_model,
48
- document={
49
- "type": "image_url",
50
- "image_url": pdf_or_img_url
51
- }
52
- )
53
- except Exception as e:
54
- return e # Return the error to the model if it fails, otherwise return the contents
55
  return "\n\n".join([f"### Page {i+1}\n{ocr_response.pages[i].markdown}" for i in range(len(ocr_response.pages))])
56
 
57
  @tool
 
42
  }
43
  )
44
  except Exception:
45
+ try: # IF PDF OCR fails, try Image OCR
46
+ ocr_response = client.ocr.process(
47
+ model=ocr_model,
48
+ document={
49
+ "type": "image_url",
50
+ "image_url": pdf_or_img_url
51
+ }
52
+ )
53
+ except Exception as e:
54
+ return e # Return the error to the model if it fails, otherwise return the contents
55
  return "\n\n".join([f"### Page {i+1}\n{ocr_response.pages[i].markdown}" for i in range(len(ocr_response.pages))])
56
 
57
  @tool