Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,16 +61,26 @@ def predict(image_np):
|
|
61 |
|
62 |
return result_pil_img
|
63 |
|
|
|
64 |
|
|
|
|
|
|
|
65 |
detection_model = load_model()
|
66 |
-
# pil_image = Image.open(image_path)
|
67 |
-
# image_arr = pil_image_as_numpy_array(pil_image)
|
68 |
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
iface = gr.Interface(fn=predict,
|
73 |
inputs=gr.Image(label='Upload an expressway image', type="pil"),
|
74 |
outputs=gr.Image(type="pil"),
|
75 |
-
title='Blue and Yellow Taxi detection using live traffic conditions along expressways (data.gov.sg)'
|
|
|
76 |
).launch(share=True)
|
|
|
61 |
|
62 |
return result_pil_img
|
63 |
|
64 |
+
def predict2(pilimg):
|
65 |
|
66 |
+
image_np = pil_image_as_numpy_array(pilimg)
|
67 |
+
return predict2(image_np)
|
68 |
+
|
69 |
detection_model = load_model()
|
|
|
|
|
70 |
|
71 |
+
Specify paths to example images
|
72 |
+
example_image_paths = ["test1.jpg"]
|
73 |
+
|
74 |
+
# Create a list of example inputs and outputs using a for loop
|
75 |
+
example_inputs = [Image.open(path) for path in example_image_paths]
|
76 |
+
example_outputs = [predict2(input_image) for input_image in example_inputs]
|
77 |
+
|
78 |
+
# Create the Gradio interface with examples using a for loop
|
79 |
+
examples = [[example_inputs[i], example_outputs[i]] for i in range(len(example_inputs))]
|
80 |
|
81 |
iface = gr.Interface(fn=predict,
|
82 |
inputs=gr.Image(label='Upload an expressway image', type="pil"),
|
83 |
outputs=gr.Image(type="pil"),
|
84 |
+
title='Blue and Yellow Taxi detection using live traffic conditions along expressways (data.gov.sg)',
|
85 |
+
example=examples
|
86 |
).launch(share=True)
|