francescoKrnl commited on
Commit
11c4ca1
Β·
verified Β·
1 Parent(s): 365e727

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -20,9 +20,10 @@ 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
- empty_input_image = { 'background': Image.new("L", (512, 512), 255),
 
24
  'layers': [Image.new("L", (512, 512), 255),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()
@@ -178,7 +179,7 @@ with gr.Blocks(css="style.css") as demo:
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
- brush = gr.Brush(default_size="4", colors=["#000000"], color_mode="fixed"),
182
  # invert_colors=True, shape=(512, 512), brush_radius=4,
183
  interactive=True, show_download_button=True, elem_id="input_image", show_label=False)
184
  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
+ def empty_input_image():
24
+ return { 'background': Image.new("L", (512, 512), 255),
25
  'layers': [Image.new("L", (512, 512), 255),Image.new("L", (512, 512), 255)],
26
+ 'composite': Image.new("L", (512, 512), 255)}
27
 
28
  def pil_image_to_data_uri(img, format='PNG'):
29
  buffered = BytesIO()
 
179
  with gr.Row(elem_id="board_row"):
180
  with gr.Group(elem_id="input_image_container", elem_classes="image_container" ):
181
  image = gr.Sketchpad(type="pil", image_mode="L",container=False, height="100%", width="100%", value = empty_input_image,
182
+ brush = gr.Brush(default_size="4", colors=["#000000"], color_mode="fixed"), layers = False,
183
  # invert_colors=True, shape=(512, 512), brush_radius=4,
184
  interactive=True, show_download_button=True, elem_id="input_image", show_label=False)
185
  gr.HTML("""<img src="file=assets/drawCta.png" id="draw_cta" alt="draw here image" />""",elem_id="draw_cta_container")