Spaces:
Sleeping
Sleeping
Commit
•
ea6c55a
1
Parent(s):
7d95523
- app.py +4 -2
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
import gradio as gr
|
2 |
import os.path
|
|
|
3 |
|
4 |
def output(image_path):
|
5 |
output_path = 'output'
|
6 |
caption = 'person . mask'
|
7 |
flag = False
|
8 |
save_image_path = os.path.join(output_path,os.path.split(image_path)[-1])
|
9 |
-
|
|
|
10 |
|
11 |
with gr.Blocks() as demo:
|
12 |
gr.Markdown("<h1><center>Demo</center></h1>")
|
13 |
img_obj = gr.Image(value ='image/test.jpg',type = "filepath",label='object_img')
|
14 |
btn = gr.Button("Submit",variant="primary")
|
15 |
-
img_output = gr.Image(type = "
|
16 |
btn.click(fn=output,inputs=[img_obj],
|
17 |
outputs=[img_output],
|
18 |
)
|
|
|
1 |
import gradio as gr
|
2 |
import os.path
|
3 |
+
from PIL import Image
|
4 |
|
5 |
def output(image_path):
|
6 |
output_path = 'output'
|
7 |
caption = 'person . mask'
|
8 |
flag = False
|
9 |
save_image_path = os.path.join(output_path,os.path.split(image_path)[-1])
|
10 |
+
save_image = Image.open(save_image_path).convert("RGB")
|
11 |
+
return save_image
|
12 |
|
13 |
with gr.Blocks() as demo:
|
14 |
gr.Markdown("<h1><center>Demo</center></h1>")
|
15 |
img_obj = gr.Image(value ='image/test.jpg',type = "filepath",label='object_img')
|
16 |
btn = gr.Button("Submit",variant="primary")
|
17 |
+
img_output = gr.Image(type = "pil",label='output_img')
|
18 |
btn.click(fn=output,inputs=[img_obj],
|
19 |
outputs=[img_output],
|
20 |
)
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pillow
|