File size: 505 Bytes
819effc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
import openai
import gradio as gr
from dotenv import load_dotenv

load_dotenv()

def generate_image(prompt):
    response = openai.images.generate(
        model="dall-e-3",
        prompt=prompt,
        size="1024x1024",
        quality="standard",
        n=1,
    )
    return response.data[0].url

app = gr.Interface(
    fn=generate_image,
    inputs=gr.Textbox(label="Describe your image"),
    outputs=gr.Image(label="Generated Image"),
    title="DALL-E Image Generator"
)

app.launch()