MakiAi commited on
Commit
bc5af2e
·
verified ·
1 Parent(s): 867296e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -5,7 +5,6 @@ from diffusers import FluxInpaintPipeline
5
 
6
  MARKDOWN = """
7
  # FLUX.1 Inpainting 🔥
8
-
9
  Shoutout to [Black Forest Labs](https://huggingface.co/black-forest-labs) team for
10
  creating this amazing model, and a big thanks to [Gothos](https://github.com/Gothos)
11
  for taking it to the next level by enabling inpainting with the FLUX.
@@ -18,7 +17,7 @@ pipe = FluxInpaintPipeline.from_pretrained(
18
 
19
 
20
  @spaces.GPU()
21
- def process(input_image_editor, input_text, progress=gr.Progress(track_tqdm=True)):
22
  if not input_text:
23
  gr.Info("Please enter a text prompt.")
24
  return None
@@ -42,7 +41,7 @@ def process(input_image_editor, input_text, progress=gr.Progress(track_tqdm=True
42
  mask_image=mask_image,
43
  width=width,
44
  height=height,
45
- strength=0.7
46
  ).images[0]
47
 
48
 
@@ -64,6 +63,13 @@ with gr.Blocks() as demo:
64
  placeholder="Enter your prompt",
65
  container=False,
66
  )
 
 
 
 
 
 
 
67
  submit_button_component = gr.Button(
68
  value='Submit', variant='primary')
69
  with gr.Column():
@@ -74,11 +80,12 @@ with gr.Blocks() as demo:
74
  fn=process,
75
  inputs=[
76
  input_image_editor_component,
77
- input_text_component
 
78
  ],
79
  outputs=[
80
  output_image_component
81
  ]
82
  )
83
 
84
- demo.launch(debug=False, show_error=True)
 
5
 
6
  MARKDOWN = """
7
  # FLUX.1 Inpainting 🔥
 
8
  Shoutout to [Black Forest Labs](https://huggingface.co/black-forest-labs) team for
9
  creating this amazing model, and a big thanks to [Gothos](https://github.com/Gothos)
10
  for taking it to the next level by enabling inpainting with the FLUX.
 
17
 
18
 
19
  @spaces.GPU()
20
+ def process(input_image_editor, input_text, strength, progress=gr.Progress(track_tqdm=True)):
21
  if not input_text:
22
  gr.Info("Please enter a text prompt.")
23
  return None
 
41
  mask_image=mask_image,
42
  width=width,
43
  height=height,
44
+ strength=strength
45
  ).images[0]
46
 
47
 
 
63
  placeholder="Enter your prompt",
64
  container=False,
65
  )
66
+ strength_slider = gr.Slider(
67
+ minimum=0.0,
68
+ maximum=1.0,
69
+ value=0.7,
70
+ step=0.01,
71
+ label="Strength"
72
+ )
73
  submit_button_component = gr.Button(
74
  value='Submit', variant='primary')
75
  with gr.Column():
 
80
  fn=process,
81
  inputs=[
82
  input_image_editor_component,
83
+ input_text_component,
84
+ strength_slider
85
  ],
86
  outputs=[
87
  output_image_component
88
  ]
89
  )
90
 
91
+ demo.launch(debug=False, show_error=True)