Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -171,10 +171,16 @@ def txt2img(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, he
|
|
| 171 |
|
| 172 |
job = prodia_client.wait(result)
|
| 173 |
|
|
|
|
|
|
|
|
|
|
| 174 |
return job["imageUrl"]
|
| 175 |
|
| 176 |
|
| 177 |
def img2img(input_image, denoising, prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
|
|
|
|
|
|
|
|
|
|
| 178 |
result = prodia_client.transform({
|
| 179 |
"imageData": image_to_base64(input_image),
|
| 180 |
"denoising_strength": denoising,
|
|
@@ -191,6 +197,9 @@ def img2img(input_image, denoising, prompt, negative_prompt, model, steps, sampl
|
|
| 191 |
|
| 192 |
job = prodia_client.wait(result)
|
| 193 |
|
|
|
|
|
|
|
|
|
|
| 194 |
return job["imageUrl"]
|
| 195 |
|
| 196 |
|
|
|
|
| 171 |
|
| 172 |
job = prodia_client.wait(result)
|
| 173 |
|
| 174 |
+
if job['status'] != "succeeded":
|
| 175 |
+
raise gr.Error("job failed")
|
| 176 |
+
|
| 177 |
return job["imageUrl"]
|
| 178 |
|
| 179 |
|
| 180 |
def img2img(input_image, denoising, prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
|
| 181 |
+
if input_image is None:
|
| 182 |
+
raise gr.Error("Please add an image to run img2img")
|
| 183 |
+
|
| 184 |
result = prodia_client.transform({
|
| 185 |
"imageData": image_to_base64(input_image),
|
| 186 |
"denoising_strength": denoising,
|
|
|
|
| 197 |
|
| 198 |
job = prodia_client.wait(result)
|
| 199 |
|
| 200 |
+
if job['status'] != "succeeded":
|
| 201 |
+
raise gr.Error("job failed")
|
| 202 |
+
|
| 203 |
return job["imageUrl"]
|
| 204 |
|
| 205 |
|