KingNish commited on
Commit
afeabee
1 Parent(s): 9941ce1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -86,7 +86,20 @@ def king(type = "Image Generation",
86
  use_resolution_binning: bool = True,
87
  progress=gr.Progress(track_tqdm=True),
88
  ):
89
- if type=="Image Generation" :
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  pipe.to(device)
91
  seed = int(randomize_seed_fn(seed, randomize_seed))
92
  generator = torch.Generator().manual_seed(seed)
@@ -104,19 +117,8 @@ def king(type = "Image Generation",
104
 
105
  output_image = pipe(**options).images[0]
106
  return seed, output_image
107
- else:
108
- seed = int(randomize_seed_fn(seed, randomize_seed))
109
- text_cfg_scale = text_cfg_scale
110
- image_cfg_scale = image_cfg_scale
111
- input_image = input_image
112
 
113
- steps=steps*3
114
- generator = torch.manual_seed(seed)
115
- output_image = pipe_edit(
116
- instruction, image=input_image,
117
- guidance_scale=text_cfg_scale, image_guidance_scale=image_cfg_scale,
118
- num_inference_steps=steps, generator=generator).images[0]
119
- return seed, output_image
120
 
121
  def response(instruction, input_image=None):
122
  if input_image is None:
 
86
  use_resolution_binning: bool = True,
87
  progress=gr.Progress(track_tqdm=True),
88
  ):
89
+ if type=="Image Editing" :
90
+ seed = int(randomize_seed_fn(seed, randomize_seed))
91
+ text_cfg_scale = text_cfg_scale
92
+ image_cfg_scale = image_cfg_scale
93
+ input_image = input_image
94
+
95
+ steps=steps*3
96
+ generator = torch.manual_seed(seed)
97
+ output_image = pipe_edit(
98
+ instruction, image=input_image,
99
+ guidance_scale=text_cfg_scale, image_guidance_scale=image_cfg_scale,
100
+ num_inference_steps=steps, generator=generator).images[0]
101
+ return seed, output_image
102
+ else :
103
  pipe.to(device)
104
  seed = int(randomize_seed_fn(seed, randomize_seed))
105
  generator = torch.Generator().manual_seed(seed)
 
117
 
118
  output_image = pipe(**options).images[0]
119
  return seed, output_image
 
 
 
 
 
120
 
121
+
 
 
 
 
 
 
122
 
123
  def response(instruction, input_image=None):
124
  if input_image is None: