Add example images to Gradio interface in app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import onnxruntime
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
@@ -27,10 +28,15 @@ def predict(input_image):
|
|
27 |
|
28 |
return Image.fromarray(output_image)
|
29 |
|
|
|
|
|
|
|
30 |
# Create Gradio interface
|
31 |
iface = gr.Interface(fn=predict,
|
32 |
inputs=gr.Image(type="pil"),
|
33 |
-
outputs=gr.Image(type="pil")
|
|
|
|
|
34 |
|
35 |
# Launch the interface
|
36 |
iface.launch()
|
|
|
1 |
+
import os
|
2 |
import onnxruntime
|
3 |
import gradio as gr
|
4 |
import numpy as np
|
|
|
28 |
|
29 |
return Image.fromarray(output_image)
|
30 |
|
31 |
+
# Specify example images
|
32 |
+
example_images = [[os.path.join("examples", fname)] for fname in os.listdir("examples")]
|
33 |
+
|
34 |
# Create Gradio interface
|
35 |
iface = gr.Interface(fn=predict,
|
36 |
inputs=gr.Image(type="pil"),
|
37 |
+
outputs=gr.Image(type="pil"),
|
38 |
+
examples=example_images
|
39 |
+
)
|
40 |
|
41 |
# Launch the interface
|
42 |
iface.launch()
|
examples/ROIs1868_summer_s1_59_p10.png
ADDED
![]() |
examples/ROIs1970_fall_s1_114_p1.png
ADDED
![]() |
examples/ROIs1970_fall_s1_115_p100.png
ADDED
![]() |
examples/ROIs1970_fall_s1_13_p265.png
ADDED
![]() |