BertChristiaens commited on
Commit
00d5911
·
1 Parent(s): 3cfee55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -67,7 +67,6 @@ def make_input_fields():
67
 
68
  return guidance_scale, inference_steps, generator_seed, static_latents, latent_walk
69
 
70
-
71
  def decode_image(image):
72
  cv2_img = cv2.imdecode(np.frombuffer(image, np.uint8), cv2.IMREAD_COLOR)
73
  cv2_img = cv2.cvtColor(cv2_img, cv2.COLOR_BGR2RGB)
@@ -95,9 +94,10 @@ if __name__ == "__main__":
95
  canvas = make_canvas(image)
96
 
97
  if st.button("Inpaint"):
98
- st.write("Inpainting!")
99
- mask_image = get_mask(np.array(canvas.image_data))
100
  result = inpainting(image, mask_image, prompt, negative_prompt)
 
101
  else:
102
  result = None
103
 
@@ -106,5 +106,5 @@ if __name__ == "__main__":
106
  st.write("The generated image will appear here.")
107
  if webcam:
108
  st.image(webcam)
109
- if result:
110
- st.image(result)
 
67
 
68
  return guidance_scale, inference_steps, generator_seed, static_latents, latent_walk
69
 
 
70
  def decode_image(image):
71
  cv2_img = cv2.imdecode(np.frombuffer(image, np.uint8), cv2.IMREAD_COLOR)
72
  cv2_img = cv2.cvtColor(cv2_img, cv2.COLOR_BGR2RGB)
 
94
  canvas = make_canvas(image)
95
 
96
  if st.button("Inpaint"):
97
+ st.write("Start inpainting process")
98
+ mask = get_mask(np.array(canvas.image_data))
99
  result = inpainting(image, mask_image, prompt, negative_prompt)
100
+ st.session_state["result"] = result
101
  else:
102
  result = None
103
 
 
106
  st.write("The generated image will appear here.")
107
  if webcam:
108
  st.image(webcam)
109
+ if 'results' in st.session_state:
110
+ st.image(st.session_state["result"])