Akjava commited on
Commit
409a240
·
1 Parent(s): 8f2132a
app.py CHANGED
@@ -47,10 +47,10 @@ def sanitize_prompt(prompt):
47
  return sanitized_prompt
48
 
49
  @spaces.GPU(duration=120)
50
- def process_examples(image, image2=None,prompt="a girl",inpaint_model="black-forest-labs/FLUX.1-schnell",strength=0.75,seed=0,progress=gr.Progress(track_tqdm=True)):
51
  # I'm not sure when this happen
52
- progress(0, desc="start-process-examples")
53
- print("start-process-examples")
54
  if not isinstance(image, dict):
55
  if image2 == None:
56
  print("empty mask")
@@ -88,7 +88,7 @@ def process_examples(image, image2=None,prompt="a girl",inpaint_model="black-for
88
  output = pipe(prompt=prompt, image=image, mask_image=mask_image,generator=generator,strength=strength,width=width,height=height,
89
  guidance_scale=0,num_inference_steps=num_inference_steps,max_sequence_length=256)
90
 
91
- return output.examples[0]
92
 
93
 
94
  output = process_inpaint(image["background"],mask,prompt,inpaint_model,strength,seed)
@@ -158,7 +158,7 @@ with gr.Blocks(css=css, elem_id="demo-container") as demo:
158
 
159
 
160
 
161
- btn.click(fn=process_examples, inputs=[image, image_mask,prompt,inpaint_model,strength,seed], outputs =[image_out,mask_out], api_name='infer')
162
  gr.Examples(
163
  examples=[
164
  ["examples/00547245_99.jpg", "examples/00547245_99_mask.jpg","a beautiful girl,eyes closed",0.8,"examples/00547245.jpg"],
 
47
  return sanitized_prompt
48
 
49
  @spaces.GPU(duration=120)
50
+ def process_images(image, image2=None,prompt="a girl",inpaint_model="black-forest-labs/FLUX.1-schnell",strength=0.75,seed=0,progress=gr.Progress(track_tqdm=True)):
51
  # I'm not sure when this happen
52
+ progress(0, desc="start-process-images")
53
+ print("start-process-images")
54
  if not isinstance(image, dict):
55
  if image2 == None:
56
  print("empty mask")
 
88
  output = pipe(prompt=prompt, image=image, mask_image=mask_image,generator=generator,strength=strength,width=width,height=height,
89
  guidance_scale=0,num_inference_steps=num_inference_steps,max_sequence_length=256)
90
 
91
+ return output.images[0]
92
 
93
 
94
  output = process_inpaint(image["background"],mask,prompt,inpaint_model,strength,seed)
 
158
 
159
 
160
 
161
+ btn.click(fn=process_images, inputs=[image, image_mask,prompt,inpaint_model,strength,seed], outputs =[image_out,mask_out], api_name='infer')
162
  gr.Examples(
163
  examples=[
164
  ["examples/00547245_99.jpg", "examples/00547245_99_mask.jpg","a beautiful girl,eyes closed",0.8,"examples/00547245.jpg"],
images/00207245.jpg DELETED
Binary file (145 kB)
 
images/00207245_18.jpg DELETED
Binary file (93.2 kB)
 
images/00207245_18_mask.jpg DELETED
Binary file (17.8 kB)
 
images/00538245.jpg DELETED
Binary file (157 kB)
 
images/00538245_mask.jpg DELETED
Binary file (22.2 kB)
 
images/00538245_paint.jpg DELETED
Binary file (146 kB)
 
images/00547245.jpg DELETED
Binary file (158 kB)
 
images/00547245_99.jpg DELETED
Binary file (188 kB)
 
images/00547245_99_mask.jpg DELETED
Binary file (17.8 kB)