Spaces:
Runtime error
Runtime error
remove options, add instructions, use dall-e-2 standard 512
Browse files
app.py
CHANGED
@@ -22,10 +22,10 @@ def generate_image(text, model, quality, size):
|
|
22 |
|
23 |
response = client.images.generate(
|
24 |
prompt=text,
|
25 |
-
model=
|
26 |
-
quality=
|
27 |
-
size=
|
28 |
-
n=1,
|
29 |
)
|
30 |
except Exception as error:
|
31 |
print(str(error))
|
@@ -35,20 +35,16 @@ def generate_image(text, model, quality, size):
|
|
35 |
|
36 |
|
37 |
with gr.Blocks() as demo:
|
38 |
-
gr.Markdown("# <center>
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
size = gr.Dropdown(choices=["1024x1024", "1792x1024", "1024x1792"], label="Size",
|
43 |
-
value="1024x1024")
|
44 |
-
|
45 |
-
text = gr.Textbox(label="Input Text",
|
46 |
placeholder="Enter your text and then click on the \"Image Generate\" button, "
|
47 |
"or simply press the Enter key.")
|
48 |
-
btn = gr.Button("Image
|
49 |
output_image = gr.Image(label="Image Output")
|
50 |
|
51 |
-
text.submit(fn=generate_image, inputs=[text
|
52 |
-
btn.click(fn=generate_image, inputs=[text
|
53 |
|
54 |
demo.launch(share=True)
|
|
|
22 |
|
23 |
response = client.images.generate(
|
24 |
prompt=text,
|
25 |
+
model="dall-e-2", # dall-e-2 or dall-e-3
|
26 |
+
quality="standard", # standard or hd
|
27 |
+
size="512x512", # varies for dalle-2 and dalle-3, see https://openai.com/pricing for resolutions
|
28 |
+
n=1, # Number of images to generate
|
29 |
)
|
30 |
except Exception as error:
|
31 |
print(str(error))
|
|
|
35 |
|
36 |
|
37 |
with gr.Blocks() as demo:
|
38 |
+
gr.Markdown("# <center> Prompt de Resistance Image Generator</center>")
|
39 |
+
gr.Markdown("**Instructions**: Generate an image from the text prompt below, then click the download arrow from the top right of the image to save it.")
|
40 |
+
|
41 |
+
text = gr.Textbox(label="What do you want to create?",
|
|
|
|
|
|
|
|
|
42 |
placeholder="Enter your text and then click on the \"Image Generate\" button, "
|
43 |
"or simply press the Enter key.")
|
44 |
+
btn = gr.Button("Generate Image")
|
45 |
output_image = gr.Image(label="Image Output")
|
46 |
|
47 |
+
text.submit(fn=generate_image, inputs=[text], outputs=output_image, api_name="generate_image")
|
48 |
+
btn.click(fn=generate_image, inputs=[text], outputs=output_image, api_name=False)
|
49 |
|
50 |
demo.launch(share=True)
|