Spaces:
Running
Running
dhanishetty
commited on
Commit
•
ec62272
1
Parent(s):
eaed816
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,27 @@
|
|
|
|
|
|
|
|
1 |
from openai import OpenAI
|
2 |
client = OpenAI(api_key= "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")
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
response = client.images.generate(
|
5 |
model="dall-e-3",
|
6 |
-
prompt=prompt,
|
7 |
size="1792x1024",
|
8 |
quality="standard",
|
9 |
n=1,
|
10 |
)
|
|
|
|
|
11 |
|
12 |
-
image_url = response.data[0].url
|
13 |
|
14 |
-
|
|
|
|
|
15 |
|
16 |
|
|
|
1 |
+
import openai
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
from openai import OpenAI
|
5 |
client = OpenAI(api_key= "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")
|
6 |
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
def get_image(prompt ):
|
12 |
response = client.images.generate(
|
13 |
model="dall-e-3",
|
14 |
+
prompt= prompt,
|
15 |
size="1792x1024",
|
16 |
quality="standard",
|
17 |
n=1,
|
18 |
)
|
19 |
+
|
20 |
+
|
21 |
|
|
|
22 |
|
23 |
+
demo = gr.Interface(fn=get_image,
|
24 |
+
inputs = [gr.Textbox(label="Enter the Prompt")],
|
25 |
+
outputs = gr.Image(type='pil'), ).launch(debug='True')
|
26 |
|
27 |
|