NikhilJoson commited on
Commit
eeae61c
·
verified ·
1 Parent(s): 59d5e77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -18,8 +18,7 @@ from diffusers import FluxTransformer2DModel, FluxInpaintPipeline
18
 
19
  MARKDOWN = """
20
  # Prompt Canvas🎨
21
- Thanks to [Black Forest Labs](https://huggingface.co/black-forest-labs) team for creating this amazing model,
22
- and a big thanks to [Gothos](https://github.com/Gothos) for taking it to the next level by enabling inpainting with the FLUX.
23
  """
24
 
25
 
@@ -261,6 +260,8 @@ def process(input_image_editor, input_text, strength, seed, randomize_seed, num_
261
  if not image:
262
  raise gr.Error("Please upload an image.")
263
  width, height = image.size
 
 
264
 
265
  if randomize_seed:
266
  seed = random.randint(0, MAX_SEED)
@@ -291,20 +292,18 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
291
  type='pil',
292
  sources=["upload", "webcam"],
293
  image_mode='RGB',
294
- layers=False,
295
- brush=gr.Brush(colors=["#FFFFFF"], color_mode="fixed"))
296
  input_text_component = gr.Text(
297
  label="Prompt",
298
  show_label=False,
299
  max_lines=1,
300
  placeholder="Enter your prompt",
301
- container=False,
302
- )
303
  with gr.Accordion("Advanced Settings", open=False):
304
  strength_slider = gr.Slider(
305
  minimum=0.0,
306
  maximum=1.0,
307
- value=0.8,
308
  step=0.01,
309
  label="Strength"
310
  )
@@ -338,7 +337,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
338
  )
339
  expansion_level = gr.Slider(
340
  minimum=0,
341
- maximum=5,
342
  value=2,
343
  step=1,
344
  label="Mask Expansion level"
 
18
 
19
  MARKDOWN = """
20
  # Prompt Canvas🎨
21
+ Made using [Flux (Schnell)](https://huggingface.co/black-forest-labs/FLUX.1-schnell), [Grounding-DINO](https://huggingface.co/docs/transformers/main/en/model_doc/grounding-dino) and [SAM](https://huggingface.co/docs/transformers/en/model_doc/sam).
 
22
  """
23
 
24
 
 
260
  if not image:
261
  raise gr.Error("Please upload an image.")
262
  width, height = image.size
263
+ if width>1024 or height>1024:
264
+ image.thumbnail((1024, 1024))
265
 
266
  if randomize_seed:
267
  seed = random.randint(0, MAX_SEED)
 
292
  type='pil',
293
  sources=["upload", "webcam"],
294
  image_mode='RGB',
295
+ layers=False)
 
296
  input_text_component = gr.Text(
297
  label="Prompt",
298
  show_label=False,
299
  max_lines=1,
300
  placeholder="Enter your prompt",
301
+ container=False,)
 
302
  with gr.Accordion("Advanced Settings", open=False):
303
  strength_slider = gr.Slider(
304
  minimum=0.0,
305
  maximum=1.0,
306
+ value=0.9,
307
  step=0.01,
308
  label="Strength"
309
  )
 
337
  )
338
  expansion_level = gr.Slider(
339
  minimum=0,
340
+ maximum=20,
341
  value=2,
342
  step=1,
343
  label="Mask Expansion level"