matteomarjanovic commited on
Commit
871938d
·
1 Parent(s): da44470

change way of loading image

Browse files
Files changed (3) hide show
  1. app.py +7 -3
  2. hoodie.png +0 -0
  3. hoodie.webp +0 -0
app.py CHANGED
@@ -146,8 +146,10 @@ css = """
146
  }
147
  """
148
 
149
- image_path = os.path.join(os.path.dirname(__file__), "hoodie.webp")
150
- default_img = Image.open(image_path)
 
 
151
 
152
  # generated_prompt = ""
153
 
@@ -156,7 +158,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
156
  with gr.Row():
157
  with gr.Column(elem_id="col-input-image"):
158
  # gr.Markdown(" ## Drop your image here")
159
- input_image = gr.Image(type="pil", sources=["upload", "clipboard"], value=default_img)
160
  with gr.Column(elem_id="col-container"):
161
  generate_button = gr.Button("Generate flat sketch", scale=0, variant="primary", elem_classes="btn btn-primary")
162
 
@@ -174,6 +176,8 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
174
  ],
175
  outputs=[generated_prompt, result],
176
  )
 
 
177
 
178
  if __name__ == "__main__":
179
  demo.launch()
 
146
  }
147
  """
148
 
149
+ def load_image():
150
+ image_path = "hoodie.png"
151
+ default_img = Image.open(image_path)
152
+ return default_img
153
 
154
  # generated_prompt = ""
155
 
 
158
  with gr.Row():
159
  with gr.Column(elem_id="col-input-image"):
160
  # gr.Markdown(" ## Drop your image here")
161
+ input_image = gr.Image(type="pil", sources=["upload", "clipboard"])
162
  with gr.Column(elem_id="col-container"):
163
  generate_button = gr.Button("Generate flat sketch", scale=0, variant="primary", elem_classes="btn btn-primary")
164
 
 
176
  ],
177
  outputs=[generated_prompt, result],
178
  )
179
+
180
+ demo.load(load_image, inputs=[], outputs=[input_image])
181
 
182
  if __name__ == "__main__":
183
  demo.launch()
hoodie.png ADDED
hoodie.webp DELETED
Binary file (21.7 kB)