Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -9,22 +9,13 @@ openai.api_key = os.getenv("OPENAI_API_KEY")
|
|
9 |
|
10 |
|
11 |
# Define the function that generates the image
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
}, headers={
|
20 |
-
"Content-Type": "application/json",
|
21 |
-
"Authorization": "Bearer "
|
22 |
-
})
|
23 |
-
response.raise_for_status()
|
24 |
-
image_url = response.json()["data"][0]["url"]
|
25 |
-
image = Image.open(BytesIO(requests.get(image_url).content))
|
26 |
-
return image
|
27 |
-
|
28 |
|
29 |
iface = gr.Interface(
|
30 |
fn=generate_image,
|
|
|
9 |
|
10 |
|
11 |
# Define the function that generates the image
|
12 |
+
response = openai.Image.create(
|
13 |
+
prompt=prompt,
|
14 |
+
n=1,
|
15 |
+
size="1024x1024"
|
16 |
+
)
|
17 |
+
image_url = response['data'][0]['url']
|
18 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
iface = gr.Interface(
|
21 |
fn=generate_image,
|