Spaces:
Runtime error
Runtime error
Initial Commit
Browse files- .ipynb_checkpoints/app-checkpoint.py +0 -35
- requirements.txt +2 -0
.ipynb_checkpoints/app-checkpoint.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
import numpy as np
|
| 2 |
-
import matplotlib.pyplot as plt
|
| 3 |
-
import cv2
|
| 4 |
-
# from segment_anything import sam_model_registry, SamPredictor
|
| 5 |
-
from preprocess import show_mask, show_points, show_box
|
| 6 |
-
import gradio as gr
|
| 7 |
-
|
| 8 |
-
def get_coord(image):
|
| 9 |
-
return coord
|
| 10 |
-
|
| 11 |
-
my_app = gr.Blocks()
|
| 12 |
-
with my_app:
|
| 13 |
-
gr.Markdown("Segment Anything Testing")
|
| 14 |
-
with gr.Tabs():
|
| 15 |
-
with gr.TabItem("Select your image"):
|
| 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 |
-
set_point.click(
|
| 26 |
-
img_source.select(get_coord),
|
| 27 |
-
[
|
| 28 |
-
img_source
|
| 29 |
-
],
|
| 30 |
-
[
|
| 31 |
-
coords
|
| 32 |
-
]
|
| 33 |
-
)
|
| 34 |
-
|
| 35 |
-
my_app.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
opencv-python
|
| 2 |
+
torch
|