Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import base64
|
| 3 |
import requests
|
| 4 |
-
import tempfile
|
| 5 |
-
import os
|
| 6 |
from openai import OpenAI
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
-
# def con_image(image1):
|
| 10 |
-
# im1 = Image.open(image1)
|
| 11 |
-
# im1.save(r'new_name.png')
|
| 12 |
-
# return im1
|
| 13 |
def create_var(image_path, open_api_key):
|
| 14 |
url_list = []
|
| 15 |
img_list = []
|
|
|
|
|
|
|
| 16 |
client = OpenAI(api_key = open_api_key)
|
| 17 |
# image2 = con_image("white_tile.jpg")
|
| 18 |
response = client.images.create_variation(
|
| 19 |
-
image=open(
|
| 20 |
n=4,
|
| 21 |
size="1024x1024"
|
| 22 |
)
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import requests
|
|
|
|
|
|
|
| 3 |
from openai import OpenAI
|
| 4 |
+
from PIL import Image
|
| 5 |
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def create_var(image_path, open_api_key):
|
| 8 |
url_list = []
|
| 9 |
img_list = []
|
| 10 |
+
im1 = Image.open(image_path)
|
| 11 |
+
im1.save(r'new_image.png')
|
| 12 |
client = OpenAI(api_key = open_api_key)
|
| 13 |
# image2 = con_image("white_tile.jpg")
|
| 14 |
response = client.images.create_variation(
|
| 15 |
+
image=open('new_image.png', "rb"),
|
| 16 |
n=4,
|
| 17 |
size="1024x1024"
|
| 18 |
)
|