Spaces:
Sleeping
Sleeping
File size: 682 Bytes
b52351a 5801106 b52351a 5801106 b52351a 5801106 |
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 26 27 28 29 |
import openai
import gradio as gr
from openai import OpenAI
client = OpenAI(api_key= "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")
title = "dall-e image generation"
description = "provide prompt to generate an image"
def get_image(prompt ):
try:
response = client.images.generate(
model="dall-e-3",
prompt= prompt,
size="1792x1024",
quality="standard",
n=1,
)
except Exception as e:
return f"An error occurred: {str(e)}"
demo = gr.Interface(fn=get_image,
inputs = [gr.Textbox(label="Enter the Prompt")],
outputs = gr.Image(type='pil'), title = title, description = description).launch(debug='True') |