Spaces:
Runtime error
Runtime error
setup app layout
Browse files- app.py +25 -4
- imgs/cat.jpg +0 -0
- requirements.txt +7 -0
app.py
CHANGED
@@ -1,7 +1,28 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
3 |
|
4 |
+
def segment_image(input_image):
|
5 |
+
output_image = input_image
|
6 |
+
return output_image
|
7 |
+
|
8 |
+
|
9 |
+
with gr.Blocks() as demo:
|
10 |
+
|
11 |
+
with gr.Row():
|
12 |
+
input_image = gr.Image(label='Input Image')
|
13 |
+
output_image = gr.Image(label='Output Image')
|
14 |
+
|
15 |
+
button = gr.Button('Mask Image')
|
16 |
+
button.click(segment_image, inputs=[input_image], outputs=output_image)
|
17 |
+
|
18 |
+
gr.Examples(
|
19 |
+
examples = [
|
20 |
+
['./imgs/cat.jpg']
|
21 |
+
],
|
22 |
+
inputs=[input_image],
|
23 |
+
outputs=[output_image],
|
24 |
+
fn=segment_image,
|
25 |
+
cache_examples=True
|
26 |
+
)
|
27 |
+
|
28 |
+
demo.launch()
|
imgs/cat.jpg
ADDED
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
opencv-python
|
3 |
+
matplotlib
|
4 |
+
numpy
|
5 |
+
torch
|
6 |
+
torchvision
|
7 |
+
git+https://github.com/facebookresearch/segment-anything.git
|