omkar56 commited on
Commit
da48084
·
1 Parent(s): e085c95

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -3
main.py CHANGED
@@ -1,6 +1,4 @@
1
  import os
2
- os.system('chmod 777 /tmp')
3
- os.system('apt-get update -y')
4
  os.system("apt-get install tesseract-ocr")
5
  from fastapi import FastAPI, File, Request, UploadFile, Body, Depends, HTTPException
6
  from fastapi.security.api_key import APIKeyHeader
@@ -29,10 +27,13 @@ async def ocr(
29
  # languages: list = Body(["eng"])
30
  ):
31
  try:
 
 
 
32
  content = await image.read()
33
  image = Image.open(BytesIO(content))
34
  # text = pytesseract.image_to_string(image, lang="+".join(languages))
35
- text = pytesseract.image_to_string(image, lang = 'eng')
36
  except Exception as e:
37
  return {"error": str(e)}, 500
38
 
 
1
  import os
 
 
2
  os.system("apt-get install tesseract-ocr")
3
  from fastapi import FastAPI, File, Request, UploadFile, Body, Depends, HTTPException
4
  from fastapi.security.api_key import APIKeyHeader
 
27
  # languages: list = Body(["eng"])
28
  ):
29
  try:
30
+ print(os.popen(f'cat /etc/debian_version').read())
31
+ print(os.popen(f'cat /etc/issue').read())
32
+ print(os.popen(f'apt search tesseract').read())
33
  content = await image.read()
34
  image = Image.open(BytesIO(content))
35
  # text = pytesseract.image_to_string(image, lang="+".join(languages))
36
+ # text = pytesseract.image_to_string(image, lang = 'eng')
37
  except Exception as e:
38
  return {"error": str(e)}, 500
39