Spaces:
Runtime error
Runtime error
Initial Commit
Browse files
app.py
CHANGED
|
@@ -5,9 +5,11 @@ import cv2
|
|
| 5 |
from preprocess import show_mask, show_points, show_box
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
-
def
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
my_app = gr.Blocks()
|
| 12 |
with my_app:
|
| 13 |
gr.Markdown("Segment Anything Testing")
|
|
@@ -16,20 +18,19 @@ with my_app:
|
|
| 16 |
with gr.Row():
|
| 17 |
with gr.Column():
|
| 18 |
img_source = gr.Image(label="Please select picture.", value='./images/truck.jpg', shape=(768, 768))
|
| 19 |
-
|
| 20 |
-
set_point = gr.Button(label="Set Point")
|
| 21 |
with gr.Column():
|
| 22 |
# img_output = gr.Image(label="Output Mask")
|
| 23 |
coords = gr.Label(label="Image Coordinate.")
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
| 34 |
|
| 35 |
my_app.launch(debug=True)
|
|
|
|
| 5 |
from preprocess import show_mask, show_points, show_box
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
+
def get_select_coords(evt: gr.SelectData):
|
| 9 |
+
position = (evt.index[0], evt.index[1])
|
| 10 |
+
img_path = images[0]
|
| 11 |
+
return img_path, position
|
| 12 |
+
|
| 13 |
my_app = gr.Blocks()
|
| 14 |
with my_app:
|
| 15 |
gr.Markdown("Segment Anything Testing")
|
|
|
|
| 18 |
with gr.Row():
|
| 19 |
with gr.Column():
|
| 20 |
img_source = gr.Image(label="Please select picture.", value='./images/truck.jpg', shape=(768, 768))
|
|
|
|
|
|
|
| 21 |
with gr.Column():
|
| 22 |
# img_output = gr.Image(label="Output Mask")
|
| 23 |
coords = gr.Label(label="Image Coordinate.")
|
| 24 |
|
| 25 |
+
input_img.select(get_select_coords, [], [img_source, coords])
|
| 26 |
+
# set_point.click(
|
| 27 |
+
# img_source.select(get_coord),
|
| 28 |
+
# [
|
| 29 |
+
# img_source
|
| 30 |
+
# ],
|
| 31 |
+
# [
|
| 32 |
+
# coords
|
| 33 |
+
# ]
|
| 34 |
+
# )
|
| 35 |
|
| 36 |
my_app.launch(debug=True)
|