yizhangliu commited on
Commit
5f65d94
1 Parent(s): 64db352

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -212,8 +212,8 @@ def read_content(file_path: str) -> str:
212
  return content
213
 
214
  def predict(dict):
215
- '''
216
- print(f'liuyz_0_', dict)
217
  init_image = dict["image"] # .convert("RGB") #.resize((512, 512))
218
  target_size = (init_image.shape[0], init_image.shape[1])
219
  print(f'liuyz_1_', init_image, target_size)
@@ -223,8 +223,8 @@ def predict(dict):
223
  '''
224
  image = Image.fromarray(dict["image"])
225
  mask= Image.fromarray(dict["mask"])
226
- output = model_process(image, mask)
227
- output = output.images[0]
228
  # output = pipe(prompt = prompt, image=init_image, mask_image=mask,guidance_scale=7.5)
229
 
230
  return output #, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
@@ -327,18 +327,20 @@ with image_blocks as demo:
327
  rounded=(True, True, True, True),
328
  full_width=True,
329
  )
330
- '''
331
  with gr.Column():
332
- image_out = gr.Image(label="Output", elem_id="output-img").style(height=400)
 
333
  with gr.Group(elem_id="share-btn-container"):
334
  community_icon = gr.HTML(community_icon_html, visible=False)
335
  loading_icon = gr.HTML(loading_icon_html, visible=False)
336
  share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
337
- '''
 
338
 
339
 
340
  # btn.click(fn=predict, inputs=[image, prompt], outputs=[image_out, community_icon, loading_icon, share_button])
341
- btn.click(fn=predict, inputs=[image], outputs=[image]) #, community_icon, loading_icon, share_button])
342
  #share_button.click(None, [], [], _js=share_js)
343
 
344
  gr.HTML(
 
212
  return content
213
 
214
  def predict(dict):
215
+ print(f'liuyz_0_', dict)
216
+ '''
217
  init_image = dict["image"] # .convert("RGB") #.resize((512, 512))
218
  target_size = (init_image.shape[0], init_image.shape[1])
219
  print(f'liuyz_1_', init_image, target_size)
 
223
  '''
224
  image = Image.fromarray(dict["image"])
225
  mask= Image.fromarray(dict["mask"])
226
+ #output = model_process(image, mask)
227
+ output = mask #output.images[0]
228
  # output = pipe(prompt = prompt, image=init_image, mask_image=mask,guidance_scale=7.5)
229
 
230
  return output #, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
 
327
  rounded=(True, True, True, True),
328
  full_width=True,
329
  )
330
+
331
  with gr.Column():
332
+ image_out = gr.Image(label="Output").style(height=400)
333
+ '''
334
  with gr.Group(elem_id="share-btn-container"):
335
  community_icon = gr.HTML(community_icon_html, visible=False)
336
  loading_icon = gr.HTML(loading_icon_html, visible=False)
337
  share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
338
+ '''
339
+
340
 
341
 
342
  # btn.click(fn=predict, inputs=[image, prompt], outputs=[image_out, community_icon, loading_icon, share_button])
343
+ btn.click(fn=predict, inputs=[image], outputs=[image_out]) #, community_icon, loading_icon, share_button])
344
  #share_button.click(None, [], [], _js=share_js)
345
 
346
  gr.HTML(