Spaces:
Running
Running
Update app.py
Browse filesRemoved not working models
app.py
CHANGED
|
@@ -5,12 +5,6 @@ from PIL import Image
|
|
| 5 |
|
| 6 |
def recognize_captcha(input, mdl):
|
| 7 |
|
| 8 |
-
# Load image
|
| 9 |
-
# image = Image.open(input).convert("RGB")
|
| 10 |
-
# Create white background
|
| 11 |
-
# background = Image.new("RGBA", image.size, (255, 255, 255))
|
| 12 |
-
# combined = Image.alpha_composite(background, image).convert("RGB")
|
| 13 |
-
|
| 14 |
# Load model and processor
|
| 15 |
processor = TrOCRProcessor.from_pretrained(mdl)
|
| 16 |
model = VisionEncoderDecoderModel.from_pretrained(mdl)
|
|
@@ -29,7 +23,7 @@ iface = gr.Interface(
|
|
| 29 |
inputs=[
|
| 30 |
gr.Image(),
|
| 31 |
gr.Dropdown(
|
| 32 |
-
['anuashok/ocr-captcha-v3','anuashok/ocr-captcha-v2','anuashok/ocr-captcha-v1','microsoft/trocr-base-printed'
|
| 33 |
)
|
| 34 |
],
|
| 35 |
outputs=['text'],
|
|
@@ -37,10 +31,10 @@ iface = gr.Interface(
|
|
| 37 |
description = "Using some TrOCR models found on the HF Hub to test/break tough text captchas. Will you have to train your own?",
|
| 38 |
examples = [
|
| 39 |
['krcx5.jpg','anuashok/ocr-captcha-v3'],
|
| 40 |
-
['hyp2a.jpg','
|
| 41 |
-
['k4kyf.jpg','
|
| 42 |
],
|
| 43 |
-
article="Created by JSGR with
|
| 44 |
)
|
| 45 |
|
| 46 |
iface.queue(max_size=10)
|
|
|
|
| 5 |
|
| 6 |
def recognize_captcha(input, mdl):
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# Load model and processor
|
| 9 |
processor = TrOCRProcessor.from_pretrained(mdl)
|
| 10 |
model = VisionEncoderDecoderModel.from_pretrained(mdl)
|
|
|
|
| 23 |
inputs=[
|
| 24 |
gr.Image(),
|
| 25 |
gr.Dropdown(
|
| 26 |
+
['anuashok/ocr-captcha-v3','anuashok/ocr-captcha-v2','anuashok/ocr-captcha-v1','microsoft/trocr-base-printed'], label='Model to use'
|
| 27 |
)
|
| 28 |
],
|
| 29 |
outputs=['text'],
|
|
|
|
| 31 |
description = "Using some TrOCR models found on the HF Hub to test/break tough text captchas. Will you have to train your own?",
|
| 32 |
examples = [
|
| 33 |
['krcx5.jpg','anuashok/ocr-captcha-v3'],
|
| 34 |
+
['hyp2a.jpg','microsoft/trocr-base-printed'],
|
| 35 |
+
['k4kyf.jpg','anuashok/ocr-captcha-v2']
|
| 36 |
],
|
| 37 |
+
article="Created by JSGR with 鉂わ笍 !!!"
|
| 38 |
)
|
| 39 |
|
| 40 |
iface.queue(max_size=10)
|