Spaces:
Sleeping
Sleeping
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() |