francescoKrnl commited on
Commit
6921d15
β€’
1 Parent(s): 4f3b924

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -20,7 +20,9 @@ model = Pix2Pix_Turbo("sketch_to_image_stochastic")
20
  ITEMS_NAMES = [ "πŸ’‘ Lamp","πŸ‘œ Bag","πŸ›‹οΈ Sofa","πŸͺ‘ Chair","🏎️ Car","🏍️ Motorbike"]
21
  MAX_SEED = np.iinfo(np.int32).max
22
  DEFAULT_ITEM_NAME = "πŸ’‘ Lamp"
23
-
 
 
24
 
25
  def pil_image_to_data_uri(img, format='PNG'):
26
  buffered = BytesIO()
@@ -175,7 +177,7 @@ with gr.Blocks(css="style.css") as demo:
175
  with gr.Column(elem_id="main_block"):
176
  with gr.Row(elem_id="board_row"):
177
  with gr.Group(elem_id="input_image_container", elem_classes="image_container" ):
178
- image = gr.Sketchpad(type="pil", image_mode="L",container=False, height="100%", width="100%",
179
  # invert_colors=True, shape=(512, 512), brush_radius=4,
180
  interactive=True, show_download_button=True, elem_id="input_image", show_label=False)
181
  gr.HTML("""<img src="file=assets/drawCta.png" id="draw_cta" alt="draw here image" />""",elem_id="draw_cta_container")
 
20
  ITEMS_NAMES = [ "πŸ’‘ Lamp","πŸ‘œ Bag","πŸ›‹οΈ Sofa","πŸͺ‘ Chair","🏎️ Car","🏍️ Motorbike"]
21
  MAX_SEED = np.iinfo(np.int32).max
22
  DEFAULT_ITEM_NAME = "πŸ’‘ Lamp"
23
+ empty_input_image = { 'background': Image.new("L", (512, 512), 255),
24
+ 'layers': [Image.new("L", (512, 512), 255)],
25
+ 'composite': Image.new("L", (512, 512), 255) }
26
 
27
  def pil_image_to_data_uri(img, format='PNG'):
28
  buffered = BytesIO()
 
177
  with gr.Column(elem_id="main_block"):
178
  with gr.Row(elem_id="board_row"):
179
  with gr.Group(elem_id="input_image_container", elem_classes="image_container" ):
180
+ image = gr.Sketchpad(type="pil", image_mode="L",container=False, height="100%", width="100%", value = empty_input_image,
181
  # invert_colors=True, shape=(512, 512), brush_radius=4,
182
  interactive=True, show_download_button=True, elem_id="input_image", show_label=False)
183
  gr.HTML("""<img src="file=assets/drawCta.png" id="draw_cta" alt="draw here image" />""",elem_id="draw_cta_container")