Spaces:
Running
Running
yizhangliu
commited on
Commit
•
32a7fde
1
Parent(s):
fc4f76a
Update app.py
Browse files
app.py
CHANGED
@@ -216,8 +216,8 @@ def predict(dict):
|
|
216 |
init_image = dict["image"] # .convert("RGB") #.resize((512, 512))
|
217 |
target_size = (init_image.shape[0], init_image.shape[1])
|
218 |
print(f'liuyz_1_', init_image, target_size)
|
219 |
-
print(f'liuyz_2_', init_image.convert("RGB"))
|
220 |
-
print(f'liuyz_3_', init_image.convert("RGB").resize((512, 512)))
|
221 |
mask = dict["mask"] # .convert("RGB") #.resize((512, 512))
|
222 |
# output = model_process(init_image, mask)
|
223 |
output = None # output.images[0]
|
@@ -317,23 +317,25 @@ with image_blocks as demo:
|
|
317 |
with gr.Column():
|
318 |
image = gr.Image(source='upload', tool='sketch', elem_id="image_upload", label="Upload") #.style(height=400)
|
319 |
with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
|
320 |
-
prompt = gr.Textbox(placeholder = 'Your prompt (what you want in place of what is erased)', show_label=False, elem_id="input-text")
|
321 |
btn = gr.Button("Done!").style(
|
322 |
margin=True,
|
323 |
rounded=(True, True, True, True),
|
324 |
full_width=True,
|
325 |
)
|
|
|
326 |
with gr.Column():
|
327 |
image_out = gr.Image(label="Output", elem_id="output-img").style(height=400)
|
328 |
with gr.Group(elem_id="share-btn-container"):
|
329 |
community_icon = gr.HTML(community_icon_html, visible=False)
|
330 |
loading_icon = gr.HTML(loading_icon_html, visible=False)
|
331 |
share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
|
|
|
332 |
|
333 |
|
334 |
-
btn.click(fn=predict, inputs=[image, prompt], outputs=[image_out, community_icon, loading_icon, share_button])
|
335 |
-
|
336 |
-
share_button.click(None, [], [], _js=share_js)
|
337 |
|
338 |
gr.HTML(
|
339 |
"""
|
|
|
216 |
init_image = dict["image"] # .convert("RGB") #.resize((512, 512))
|
217 |
target_size = (init_image.shape[0], init_image.shape[1])
|
218 |
print(f'liuyz_1_', init_image, target_size)
|
219 |
+
print(f'liuyz_2_', init_image.convert("RGB").shape)
|
220 |
+
print(f'liuyz_3_', init_image.convert("RGB").resize((512, 512)).shape)
|
221 |
mask = dict["mask"] # .convert("RGB") #.resize((512, 512))
|
222 |
# output = model_process(init_image, mask)
|
223 |
output = None # output.images[0]
|
|
|
317 |
with gr.Column():
|
318 |
image = gr.Image(source='upload', tool='sketch', elem_id="image_upload", label="Upload") #.style(height=400)
|
319 |
with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
|
320 |
+
# prompt = gr.Textbox(placeholder = 'Your prompt (what you want in place of what is erased)', show_label=False, elem_id="input-text")
|
321 |
btn = gr.Button("Done!").style(
|
322 |
margin=True,
|
323 |
rounded=(True, True, True, True),
|
324 |
full_width=True,
|
325 |
)
|
326 |
+
'''
|
327 |
with gr.Column():
|
328 |
image_out = gr.Image(label="Output", elem_id="output-img").style(height=400)
|
329 |
with gr.Group(elem_id="share-btn-container"):
|
330 |
community_icon = gr.HTML(community_icon_html, visible=False)
|
331 |
loading_icon = gr.HTML(loading_icon_html, visible=False)
|
332 |
share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
|
333 |
+
'''
|
334 |
|
335 |
|
336 |
+
# btn.click(fn=predict, inputs=[image, prompt], outputs=[image_out, community_icon, loading_icon, share_button])
|
337 |
+
btn.click(fn=predict, inputs=[image], outputs=[image]) #, community_icon, loading_icon, share_button])
|
338 |
+
#share_button.click(None, [], [], _js=share_js)
|
339 |
|
340 |
gr.HTML(
|
341 |
"""
|