5m4ck3r commited on
Commit
fbe3348
1 Parent(s): 06fe5d8

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -1
main.py CHANGED
@@ -132,7 +132,6 @@ def valuate_qna(p: str, r: str) -> str:
132
  return hug.output.get("data", [None])[0]
133
 
134
  def ocr(image: io.BytesIO) -> str:
135
- image = compress_image(image) # Compress the image
136
  return process_image(image, os.getenv('AZKEY'), os.getenv('AZURL'))
137
 
138
  app = Flask(__name__)
@@ -187,6 +186,9 @@ def task_ocr():
187
  headers = dict(request.headers)
188
  if not headers.get("KEY") != os.getenv("KEY"):
189
  return jsonify({"status" : False, "msg" : "Invalid API Key"}), 404
 
 
 
190
  answer = ocr(file_content)
191
  return jsonify({"status" : True, "data" : answer})
192
 
 
132
  return hug.output.get("data", [None])[0]
133
 
134
  def ocr(image: io.BytesIO) -> str:
 
135
  return process_image(image, os.getenv('AZKEY'), os.getenv('AZURL'))
136
 
137
  app = Flask(__name__)
 
186
  headers = dict(request.headers)
187
  if not headers.get("KEY") != os.getenv("KEY"):
188
  return jsonify({"status" : False, "msg" : "Invalid API Key"}), 404
189
+ size = len(file_content.getvalue())
190
+ if size > 4194304:
191
+ return jsonify({"status" : False, "msg" : "File size is greater then 4MB"}), 404
192
  answer = ocr(file_content)
193
  return jsonify({"status" : True, "data" : answer})
194