File size: 1,050 Bytes
147da8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
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()