Spaces:
Runtime error
Runtime error
Commit
·
8f35dfd
1
Parent(s):
a0b5962
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,17 +17,14 @@ def generate_image(prompt, seed=0, negative_prompt="", model="Deliberate", sampl
|
|
| 17 |
"steps": steps
|
| 18 |
}
|
| 19 |
response = requests.post(api_url, data=data)
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
return img
|
| 29 |
-
else:
|
| 30 |
-
return None
|
| 31 |
|
| 32 |
inputs = [
|
| 33 |
gr.inputs.Textbox(label="Prompt"),
|
|
|
|
| 17 |
"steps": steps
|
| 18 |
}
|
| 19 |
response = requests.post(api_url, data=data)
|
| 20 |
+
# Decode the base64 image string
|
| 21 |
+
img_bytes = base64.b64decode(response.json()["url"])
|
| 22 |
+
|
| 23 |
+
# Open the image using Pillow
|
| 24 |
+
img = Image.open(io.BytesIO(img_bytes))
|
| 25 |
+
|
| 26 |
+
# Return the image object
|
| 27 |
+
return img
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
inputs = [
|
| 30 |
gr.inputs.Textbox(label="Prompt"),
|