Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,20 @@
|
|
| 1 |
-
|
| 2 |
-
import
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from openai import OpenAI
|
| 2 |
+
from PIL import Image
|
| 3 |
+
|
| 4 |
+
def con_image(image1):
|
| 5 |
+
im1 = Image.open(image1)
|
| 6 |
+
im1.save(r'new_name.png')
|
| 7 |
+
return im1
|
| 8 |
+
|
| 9 |
+
client = OpenAI(api_key = "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")
|
| 10 |
+
image2 = con_image("white_tile.jpg")
|
| 11 |
+
response = client.images.create_variation(
|
| 12 |
+
image=open(image2, "rb"),
|
| 13 |
+
# prompt="Convert the image into a animated image",
|
| 14 |
+
n=1,
|
| 15 |
+
size="1024x1024"
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
image_url = response.data[0].url
|
| 19 |
+
print(response.data[0])
|
| 20 |
+
print(image_url)
|