File size: 463 Bytes
57fb0f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr

from detection_pipeline import DetectionModel

model = DetectionModel()

def predict(image, threshold):
    preds = model(image)
    preds = list(filter(lambda x: x[4] > threshold, preds))

    output = model.visualize(image, preds)
    return output



interface = gr.Interface(
    fn=predict,
    inputs=[gr.Image(label="Input"), gr.Slider(0, 1, .3, step=.05, label="Threshold")],
    outputs=gr.Image(label="Output")
)

interface.launch()