craftgamesnetwork commited on
Commit
eeba3f2
·
verified ·
1 Parent(s): c0e9a54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -43
app.py CHANGED
@@ -110,49 +110,49 @@ def generate(
110
  if not use_negative_prompt_2:
111
  negative_prompt_2 = None # type: ignore
112
 
113
- if use_inpainting:
114
- images = pipe(
115
- prompt=prompt,
116
- image=img_url,
117
- mask_image=mask_url,
118
- strength=strength_img2img,
119
- negative_prompt=negative_prompt,
120
- prompt_2=prompt_2,
121
- negative_prompt_2=negative_prompt_2,
122
- guidance_scale=guidance_scale_base,
123
- num_inference_steps=num_inference_steps_base,
124
- generator=generator,
125
- ).images[0]
126
- return images
127
- elif use_img2img:
128
- images = pipe(
129
- prompt=prompt,
130
- image=init_image,
131
- strength=strength_img2img,
132
- negative_prompt=negative_prompt,
133
- prompt_2=prompt_2,
134
- negative_prompt_2=negative_prompt_2,
135
- width=width,
136
- height=height,
137
- guidance_scale=guidance_scale_base,
138
- num_inference_steps=num_inference_steps_base,
139
- generator=generator,
140
- output_type="pil",
141
- ).images[0]
142
- return images
143
- else:
144
- return pipe(
145
- prompt=prompt,
146
- negative_prompt=negative_prompt,
147
- prompt_2=prompt_2,
148
- negative_prompt_2=negative_prompt_2,
149
- width=width,
150
- height=height,
151
- guidance_scale=guidance_scale_base,
152
- num_inference_steps=num_inference_steps_base,
153
- generator=generator,
154
- output_type="pil",
155
- ).images[0]
156
 
157
  with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo:
158
  gr.HTML(
 
110
  if not use_negative_prompt_2:
111
  negative_prompt_2 = None # type: ignore
112
 
113
+ if use_inpainting:
114
+ images = pipe(
115
+ prompt=prompt,
116
+ image=img_url,
117
+ mask_image=mask_url,
118
+ strength=strength_img2img,
119
+ negative_prompt=negative_prompt,
120
+ prompt_2=prompt_2,
121
+ negative_prompt_2=negative_prompt_2,
122
+ guidance_scale=guidance_scale_base,
123
+ num_inference_steps=num_inference_steps_base,
124
+ generator=generator,
125
+ ).images[0]
126
+ return images
127
+ elif use_img2img:
128
+ images = pipe(
129
+ prompt=prompt,
130
+ image=init_image,
131
+ strength=strength_img2img,
132
+ negative_prompt=negative_prompt,
133
+ prompt_2=prompt_2,
134
+ negative_prompt_2=negative_prompt_2,
135
+ width=width,
136
+ height=height,
137
+ guidance_scale=guidance_scale_base,
138
+ num_inference_steps=num_inference_steps_base,
139
+ generator=generator,
140
+ output_type="pil",
141
+ ).images[0]
142
+ return images
143
+ else:
144
+ return pipe(
145
+ prompt=prompt,
146
+ negative_prompt=negative_prompt,
147
+ prompt_2=prompt_2,
148
+ negative_prompt_2=negative_prompt_2,
149
+ width=width,
150
+ height=height,
151
+ guidance_scale=guidance_scale_base,
152
+ num_inference_steps=num_inference_steps_base,
153
+ generator=generator,
154
+ output_type="pil",
155
+ ).images[0]
156
 
157
  with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo:
158
  gr.HTML(