|
import gradio as gr |
|
|
|
from cc_ocr.predict_wrapper import predict_fn |
|
|
|
description = """ |
|
The <b>SEMI Font</b> (a.k.a. <b>SEMI OCR Font</b>) is specified by SEMI M12/M13 standard, widely used in semiconductor industries. |
|
|
|
Select the examples at the bottom to see it in action. |
|
""" |
|
|
|
def _get_examples(): |
|
examples = [ |
|
[f"images/{i}.png", |
|
"models/classifier/semidouble_black_20241021093205", |
|
0] for i in range(13) |
|
] |
|
return examples |
|
|
|
def launch(): |
|
intf = gr.Interface( |
|
title="SEMI OCR", |
|
description=description, |
|
fn=predict_fn, |
|
inputs=[ |
|
gr.Image(label="Image"), |
|
gr.Text(label="Model", interactive=False), |
|
gr.Slider(label="Threshold", value=0, step=0.01, minimum=0, maximum=1) |
|
], |
|
outputs=[ |
|
gr.Image(label="Detection"), |
|
gr.Text(label="Detection", interactive=False) |
|
], |
|
examples=_get_examples(), |
|
flagging_mode="never" |
|
) |
|
intf.launch() |
|
|
|
if __name__ == "__main__": |
|
launch() |