Akjava commited on
Commit
b8ddd7d
·
1 Parent(s): 97398f7

add condition

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. flux1_inpaint.py +4 -3
app.py CHANGED
@@ -61,7 +61,7 @@ with demo_blocks as demo:
61
  gr.HTML(read_file("demo_header.html"))
62
  with gr.Row():
63
  with gr.Column():
64
- image = gr.ImageEditor(height=1000,sources=['upload','clipboard'],transforms=[],image_mode='RGB', layers=False, elem_id="image_upload", type="pil", label="Upload",brush=gr.Brush(colors=["#999"], color_mode="fixed"))
65
  with gr.Row(elem_id="prompt-container", equal_height=False):
66
  with gr.Row():
67
  prompt = gr.Textbox(label="Prompt",value="a eyes closed girl,shut eyes",placeholder="Your prompt (what you want in place of what is erased)", elem_id="prompt")
 
61
  gr.HTML(read_file("demo_header.html"))
62
  with gr.Row():
63
  with gr.Column():
64
+ image = gr.ImageEditor(height=1000,sources=['upload','clipboard'],transforms=[],image_mode='RGB', layers=False, elem_id="image_upload", type="pil", label="Upload",brush=gr.Brush(colors=["#fff"], color_mode="fixed"))
65
  with gr.Row(elem_id="prompt-container", equal_height=False):
66
  with gr.Row():
67
  prompt = gr.Textbox(label="Prompt",value="a eyes closed girl,shut eyes",placeholder="Your prompt (what you want in place of what is erased)", elem_id="prompt")
flux1_inpaint.py CHANGED
@@ -36,12 +36,13 @@ def make_inpaint_condition(image, image_mask):
36
  def process_image(image,mask_image,prompt="a girl",negative_prompt="",model_id="black-forest-labs/FLUX.1-schnell",strength=0.75,seed=0,num_inference_steps=4):
37
 
38
 
39
-
40
- #control_image=make_inpaint_condition(image,mask_image)
41
- #image.save("_control.jpg")
42
  if image == None:
43
  return None
44
 
 
 
 
 
45
  pipe = FluxInpaintPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
46
  pipe.to(device)
47
  #batch_size =1
 
36
  def process_image(image,mask_image,prompt="a girl",negative_prompt="",model_id="black-forest-labs/FLUX.1-schnell",strength=0.75,seed=0,num_inference_steps=4):
37
 
38
 
 
 
 
39
  if image == None:
40
  return None
41
 
42
+ control_image=make_inpaint_condition(image,mask_image)
43
+ #image.save("_control.jpg")
44
+ image = control_image
45
+
46
  pipe = FluxInpaintPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
47
  pipe.to(device)
48
  #batch_size =1