Spaces:
Runtime error
Runtime error
File size: 955 Bytes
25e4693 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import gradio as gr
import CaptchaCracker as cc
# Target image data size
img_width = 200
img_height = 50
# Target image label length
max_length = 6
# Target image label component
characters = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
# Model weight file path
weights_path = "weights.h5"
# Creating a model application instance
AM = cc.ApplyModel(weights_path, img_width, img_height, max_length, characters)
def inference(target_img_path):
# Predicted value
pred = AM.predict(target_img_path)
return pred
block = gr.Blocks()
with block:
gr.Markdown("Gradio Demo for WooilJeong/CaptchaCracker")
with gr.Tabs():
with gr.TabItem("CaptchaCracker"):
with gr.Row():
captchaimg = gr.inputs.Image(type="filepath")
text = gr.outputs.Textbox()
catch_run = gr.Button("Run")
catch_run.click(inference, inputs=captchaimg, outputs=text)
block.launch() |