Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def process_image(image):
|
|
| 32 |
else:
|
| 33 |
img = image.convert('RGB')
|
| 34 |
|
| 35 |
-
predictor = load_predictor('captcha-
|
| 36 |
text = predictor.pred_img(img, show=False)
|
| 37 |
return text
|
| 38 |
|
|
|
|
| 32 |
else:
|
| 33 |
img = image.convert('RGB')
|
| 34 |
|
| 35 |
+
predictor = load_predictor('captcha-7400.safetensors')
|
| 36 |
text = predictor.pred_img(img, show=False)
|
| 37 |
return text
|
| 38 |
|
cap.py
CHANGED
|
@@ -10,11 +10,11 @@ from PIL import Image
|
|
| 10 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 11 |
|
| 12 |
char_dict = '_0123456789abcdefghijklmnopqrstuvwxyz'
|
| 13 |
-
|
| 14 |
|
| 15 |
|
| 16 |
class Predictor:
|
| 17 |
-
def __init__(self, model_path, char_dict=
|
| 18 |
self.model = ResnetEncoderDecoder(char_dict).to(device)
|
| 19 |
self.model.eval()
|
| 20 |
if str(device)=='cpu':
|
|
|
|
| 10 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 11 |
|
| 12 |
char_dict = '_0123456789abcdefghijklmnopqrstuvwxyz'
|
| 13 |
+
char_dict_pp = '_0123456789abcdefghijklmnopqrstuvwxyz()+-*/='
|
| 14 |
|
| 15 |
|
| 16 |
class Predictor:
|
| 17 |
+
def __init__(self, model_path, char_dict=char_dict_pp):
|
| 18 |
self.model = ResnetEncoderDecoder(char_dict).to(device)
|
| 19 |
self.model.eval()
|
| 20 |
if str(device)=='cpu':
|