omkar56 commited on
Commit
ab81f2e
·
1 Parent(s): c1aa791

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -1
main.py CHANGED
@@ -41,14 +41,16 @@ async def ocr(
41
  # languages: list = Body(["eng"])
42
  ):
43
  try:
44
- print("[Hello]", image)
45
  # # Check if the file format is allowed
46
  # file_extension = image.filename.split(".")[-1].lower()
47
  # if file_extension not in VALID_IMAGE_EXTENSIONS:
48
  # raise HTTPException(status_code=400, detail="Invalid file format. Only .jpg, .jpeg, and .png are allowed.")
49
 
50
  content = await image.read()
 
51
  image = Image.open(BytesIO(content))
 
52
  text = pytesseract.image_to_string(image, lang = 'eng')
53
  # text = pytesseract.image_to_string(image, lang="+".join(languages))
54
  except Exception as e:
 
41
  # languages: list = Body(["eng"])
42
  ):
43
  try:
44
+
45
  # # Check if the file format is allowed
46
  # file_extension = image.filename.split(".")[-1].lower()
47
  # if file_extension not in VALID_IMAGE_EXTENSIONS:
48
  # raise HTTPException(status_code=400, detail="Invalid file format. Only .jpg, .jpeg, and .png are allowed.")
49
 
50
  content = await image.read()
51
+ print("[content]", content)
52
  image = Image.open(BytesIO(content))
53
+ print("[image]", image)
54
  text = pytesseract.image_to_string(image, lang = 'eng')
55
  # text = pytesseract.image_to_string(image, lang="+".join(languages))
56
  except Exception as e: