Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -28,10 +28,13 @@ def generate_image(prompt, image=None, output_filename="generated_image"):
|
|
28 |
img_byte_arr = io.BytesIO()
|
29 |
image.save(img_byte_arr, format="PNG")
|
30 |
img_bytes = img_byte_arr.getvalue()
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
|
36 |
contents = [
|
37 |
types.Content(
|
|
|
28 |
img_byte_arr = io.BytesIO()
|
29 |
image.save(img_byte_arr, format="PNG")
|
30 |
img_bytes = img_byte_arr.getvalue()
|
31 |
+
# Add the image as a Part with inline_data
|
32 |
+
parts.append({
|
33 |
+
"inline_data": {
|
34 |
+
"mime_type": "image/png",
|
35 |
+
"data": img_bytes
|
36 |
+
}
|
37 |
+
})
|
38 |
|
39 |
contents = [
|
40 |
types.Content(
|