mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
TimeoutError when using pytesseract
This commit is contained in:
parent
697d424bdf
commit
8396cf5e60
1 changed files with 2 additions and 0 deletions
|
@ -863,6 +863,8 @@ def make_image_sizes_async(file_id, thumbnail_width, medium_width, directory):
|
|||
image_text = pytesseract.image_to_string(Image.open(BytesIO(source_image)).convert('L'), timeout=30)
|
||||
except FileNotFoundError as e:
|
||||
image_text = ''
|
||||
except TimeoutError as e:
|
||||
image_text = ''
|
||||
if 'Anonymous' in image_text and ('No.' in image_text or ' N0' in image_text): # chan posts usually contain the text 'Anonymous' and ' No.12345'
|
||||
post = Post.query.filter_by(image_id=file.id).first()
|
||||
notification = Notification(title='Review this',
|
||||
|
|
Loading…
Add table
Reference in a new issue