File size: 454 Bytes
e4083ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from infer_onnx import infer_onnx

def predict_from_image(image):
    image.save("uploaded.png")
    prediction = infer_onnx("model.onnx", "uploaded.png")
    return prediction

iface = gr.Interface(
    fn=predict_from_image,
    inputs=gr.Image(type="pil"),
    outputs="text",
    title="ONNX CAPTCHA Inference",
    description="Upload an image to get prediction from ONNX model."
)

if __name__ == "__main__":
    iface.launch()