importgradioasgrimportnumpyasnpimportosfromsrc.detectionimportDetector# UGC: Define the inference fn() for your modelsdefmodel_inference(image):image,json_out=Detector('PP-YOLO')(image)returnimage,json_outdefclear_all():returnNone,None,Nonewithgr.Blocks()asdemo:gr.Markdown("Objective Detection")withgr.Column(scale=1,min_width=100):img_in=gr.Image(label="Input").style(height=200)withgr.Row():btn1=gr.Button("Clear")btn2=gr.Button("Submit")img_out=gr.Image(label="Output").style(height=200)json_out=gr.JSON(label="jsonOutput")btn2.click(fn=model_inference,inputs=img_in,outputs=[img_out,json_out])btn1.click(fn=clear_all,inputs=None,outputs=[img_in,img_out,json_out])gr.Button.style(1)demo.launch()