Spaces:
Runtime error
Runtime error
know-one-1
commited on
Commit
·
03d9113
1
Parent(s):
7e2640a
layout change
Browse files
app.py
CHANGED
@@ -73,19 +73,19 @@ def change_order(choice):
|
|
73 |
|
74 |
def change_button(choice):
|
75 |
if choice == "simple":
|
76 |
-
return gr.
|
77 |
canny_edge_detector, inputs=image_input, outputs=image_output
|
78 |
)
|
79 |
elif choice == "sobel":
|
80 |
-
return gr.
|
81 |
sobel_edge_detector, inputs=image_input, outputs=image_output
|
82 |
)
|
83 |
elif choice == "laplacian":
|
84 |
-
return gr.
|
85 |
laplacian_edge_detector, inputs=image_input, outputs=image_output
|
86 |
)
|
87 |
else:
|
88 |
-
return gr.
|
89 |
simple_edge_detector, inputs=image_input, outputs=image_output
|
90 |
)
|
91 |
|
@@ -96,8 +96,9 @@ with gr.Blocks() as demo:
|
|
96 |
image_output = gr.Image()
|
97 |
radio = gr.Radio(
|
98 |
["canny", "simple", "sobel", "laplacian"],
|
99 |
-
label="
|
100 |
)
|
|
|
101 |
kernel = gr.Slider(
|
102 |
minimum=1,
|
103 |
maximum=6,
|
@@ -119,6 +120,7 @@ with gr.Blocks() as demo:
|
|
119 |
radio.change(fn=change_kernel, inputs=radio, outputs=kernel)
|
120 |
radio.change(fn=change_order, inputs=radio, outputs=order)
|
121 |
radio.change(fn=change_button, inputs=radio, outputs=Button)
|
|
|
122 |
|
123 |
|
124 |
demo.launch()
|
|
|
73 |
|
74 |
def change_button(choice):
|
75 |
if choice == "simple":
|
76 |
+
return gr.update("Detect").click(
|
77 |
canny_edge_detector, inputs=image_input, outputs=image_output
|
78 |
)
|
79 |
elif choice == "sobel":
|
80 |
+
return gr.update("Detect").click(
|
81 |
sobel_edge_detector, inputs=image_input, outputs=image_output
|
82 |
)
|
83 |
elif choice == "laplacian":
|
84 |
+
return gr.update("Detect").click(
|
85 |
laplacian_edge_detector, inputs=image_input, outputs=image_output
|
86 |
)
|
87 |
else:
|
88 |
+
return gr.update("Detect").click(
|
89 |
simple_edge_detector, inputs=image_input, outputs=image_output
|
90 |
)
|
91 |
|
|
|
96 |
image_output = gr.Image()
|
97 |
radio = gr.Radio(
|
98 |
["canny", "simple", "sobel", "laplacian"],
|
99 |
+
label="Type of Edge Detector",
|
100 |
)
|
101 |
+
with gr.Row():
|
102 |
kernel = gr.Slider(
|
103 |
minimum=1,
|
104 |
maximum=6,
|
|
|
120 |
radio.change(fn=change_kernel, inputs=radio, outputs=kernel)
|
121 |
radio.change(fn=change_order, inputs=radio, outputs=order)
|
122 |
radio.change(fn=change_button, inputs=radio, outputs=Button)
|
123 |
+
gr.Examples(examples)
|
124 |
|
125 |
|
126 |
demo.launch()
|