Spaces:
Runtime error
Runtime error
dreamdrop-art
commited on
Commit
·
7e726ee
1
Parent(s):
e042973
Update app.py
Browse files
app.py
CHANGED
@@ -20,18 +20,21 @@ def query(payload, model):
|
|
20 |
return response.content
|
21 |
|
22 |
def hf_inference(prompt, negative, model, steps, sampler, guidance, width, height, seed):
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
"
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
|
36 |
|
37 |
|
|
|
20 |
return response.content
|
21 |
|
22 |
def hf_inference(prompt, negative, model, steps, sampler, guidance, width, height, seed):
|
23 |
+
try:
|
24 |
+
image_bytes = query(payload={
|
25 |
+
"inputs": f"{prompt}",
|
26 |
+
"parameters": {
|
27 |
+
"negative_prompt": f"{negative}",
|
28 |
+
"num_inference_steps": steps,
|
29 |
+
"guidance_scale": guidance,
|
30 |
+
"width": width, "height": height,
|
31 |
+
"seed": seed,
|
32 |
+
},
|
33 |
+
}, model=model)
|
34 |
+
image = Image.open(io.BytesIO(image_bytes))
|
35 |
+
return image
|
36 |
+
expect PIL.UnidentifiedImageError:
|
37 |
+
gr.Warning("This model is not loaded now. Try others models.")
|
38 |
|
39 |
|
40 |
|