Spaces:
Sleeping
Sleeping
Update app/utils.py
Browse files- app/utils.py +4 -1
app/utils.py
CHANGED
@@ -4,6 +4,8 @@ from transformers import AutoModel, AutoTokenizer
|
|
4 |
from PIL import Image, ImageEnhance, ImageFilter
|
5 |
import torch
|
6 |
import logging
|
|
|
|
|
7 |
|
8 |
logger = logging.getLogger(__name__)
|
9 |
|
@@ -18,7 +20,8 @@ class OCRModel:
|
|
18 |
|
19 |
def initialize(self):
|
20 |
try:
|
21 |
-
|
|
|
22 |
logger.info("Initializing OCR model...")
|
23 |
# Try loading with use_fast=False if the fast tokenizer fails
|
24 |
try:
|
|
|
4 |
from PIL import Image, ImageEnhance, ImageFilter
|
5 |
import torch
|
6 |
import logging
|
7 |
+
from huggingface_hub import delete_cache
|
8 |
+
|
9 |
|
10 |
logger = logging.getLogger(__name__)
|
11 |
|
|
|
20 |
|
21 |
def initialize(self):
|
22 |
try:
|
23 |
+
|
24 |
+
delete_cache()
|
25 |
logger.info("Initializing OCR model...")
|
26 |
# Try loading with use_fast=False if the fast tokenizer fails
|
27 |
try:
|