Akjava commited on
Commit
1bac392
1 Parent(s): d2b44ad

fix example

Browse files
Files changed (1) hide show
  1. app.py +2 -19
app.py CHANGED
@@ -28,26 +28,9 @@ def sanitize_prompt(prompt):
28
 
29
 
30
  @spaces.GPU(duration=120)
31
- def process_images(image, image2=None,prompt="a girl",strength=0.75,seed=0,inference_step=4,progress=gr.Progress(track_tqdm=True)):
32
  print("start process_images")
33
  progress(0, desc="Starting")
34
- # I'm not sure when this happen
35
- if not isinstance(image, dict):
36
- if image2 == None:
37
- print("empty mask")
38
- return image
39
- else:
40
- image = dict({'background': image, 'layers': [image2]})
41
-
42
- if image2!=None:
43
- #print("use image2")
44
- mask = image2
45
- else:
46
- if len(image['layers']) == 0:
47
- print("empty mask")
48
- return image
49
- print("use layer")
50
- mask = image['layers'][0]
51
 
52
 
53
  def process_img2img(image,prompt="a person",strength=0.75,seed=0,num_inference_steps=4):
@@ -67,7 +50,7 @@ def process_images(image, image2=None,prompt="a girl",strength=0.75,seed=0,infer
67
  # TODO support mask
68
  return output.images[0]
69
 
70
- output = process_img2img(image["background"],mask,prompt,strength,seed,inference_step)
71
 
72
  print("end process_images")
73
  return output
 
28
 
29
 
30
  @spaces.GPU(duration=120)
31
+ def process_images(image,prompt="a girl",strength=0.75,seed=0,inference_step=4,progress=gr.Progress(track_tqdm=True)):
32
  print("start process_images")
33
  progress(0, desc="Starting")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
 
36
  def process_img2img(image,prompt="a person",strength=0.75,seed=0,num_inference_steps=4):
 
50
  # TODO support mask
51
  return output.images[0]
52
 
53
+ output = process_img2img(image,prompt,strength,seed,inference_step)
54
 
55
  print("end process_images")
56
  return output