Spaces:
Runtime error
Runtime error
dreamdrop-art
commited on
Commit
·
341f459
1
Parent(s):
f1d8f65
Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,7 @@ def hf_inference(prompt, negative, model, steps, sampler, guidance, width, heigh
|
|
26 |
images=[]
|
27 |
time.sleep(1)
|
28 |
progress(0.05)
|
|
|
29 |
image_bytes = query(payload={
|
30 |
"inputs": f"{prompt}",
|
31 |
"parameters": {
|
@@ -36,8 +37,10 @@ def hf_inference(prompt, negative, model, steps, sampler, guidance, width, heigh
|
|
36 |
"seed": seed,
|
37 |
},
|
38 |
}, model=model)
|
|
|
39 |
image = Image.open(io.BytesIO(image_bytes))
|
40 |
images.append(image)
|
|
|
41 |
return images
|
42 |
except PIL.UnidentifiedImageError:
|
43 |
gr.Warning("This model is not loaded now. Try others models.")
|
@@ -198,6 +201,9 @@ for model_name in model_list:
|
|
198 |
|
199 |
|
200 |
def txt2img(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
|
|
|
|
|
|
|
201 |
result = prodia_client.generate({
|
202 |
"prompt": prompt,
|
203 |
"negative_prompt": negative_prompt,
|
@@ -209,13 +215,18 @@ def txt2img(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, he
|
|
209 |
"height": height,
|
210 |
"seed": seed
|
211 |
})
|
212 |
-
|
213 |
job = prodia_client.wait(result)
|
214 |
-
|
215 |
return job["imageUrl"]
|
216 |
|
217 |
|
218 |
def img2img(input_image, denoising, prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
|
|
|
|
|
|
|
|
|
|
|
219 |
result = prodia_client.transform({
|
220 |
"imageData": image_to_base64(input_image),
|
221 |
"denoising_strength": denoising,
|
@@ -229,9 +240,10 @@ def img2img(input_image, denoising, prompt, negative_prompt, model, steps, sampl
|
|
229 |
"height": height,
|
230 |
"seed": seed
|
231 |
})
|
|
|
232 |
|
233 |
job = prodia_client.wait(result)
|
234 |
-
|
235 |
return job["imageUrl"]
|
236 |
|
237 |
|
|
|
26 |
images=[]
|
27 |
time.sleep(1)
|
28 |
progress(0.05)
|
29 |
+
progress(025, desc="Generaing")
|
30 |
image_bytes = query(payload={
|
31 |
"inputs": f"{prompt}",
|
32 |
"parameters": {
|
|
|
37 |
"seed": seed,
|
38 |
},
|
39 |
}, model=model)
|
40 |
+
progress(75, desc="Opening image")
|
41 |
image = Image.open(io.BytesIO(image_bytes))
|
42 |
images.append(image)
|
43 |
+
progress(99, desc="Sending image")
|
44 |
return images
|
45 |
except PIL.UnidentifiedImageError:
|
46 |
gr.Warning("This model is not loaded now. Try others models.")
|
|
|
201 |
|
202 |
|
203 |
def txt2img(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
|
204 |
+
progress(0, desc="Starting")
|
205 |
+
time.sleep(2.5)
|
206 |
+
progress(25, desc="Generating")
|
207 |
result = prodia_client.generate({
|
208 |
"prompt": prompt,
|
209 |
"negative_prompt": negative_prompt,
|
|
|
215 |
"height": height,
|
216 |
"seed": seed
|
217 |
})
|
218 |
+
progress(75, desc="Opening image")
|
219 |
job = prodia_client.wait(result)
|
220 |
+
progress(99, desc="Sending image")
|
221 |
return job["imageUrl"]
|
222 |
|
223 |
|
224 |
def img2img(input_image, denoising, prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed):
|
225 |
+
progress(0, desc="Starting")
|
226 |
+
time.sleep(1.5)
|
227 |
+
progress(10, desc="Uploading input image")
|
228 |
+
time.sleep(1.5)
|
229 |
+
progress(25, desc="Generating")
|
230 |
result = prodia_client.transform({
|
231 |
"imageData": image_to_base64(input_image),
|
232 |
"denoising_strength": denoising,
|
|
|
240 |
"height": height,
|
241 |
"seed": seed
|
242 |
})
|
243 |
+
progress(75, desc="Opening image")
|
244 |
|
245 |
job = prodia_client.wait(result)
|
246 |
+
progress(99, desc="Sending image")
|
247 |
return job["imageUrl"]
|
248 |
|
249 |
|