-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
29 lines (23 loc) · 676 Bytes
/
main.py
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
from PIL import Image
import streamlit as st
from apikey import apikey
def generate_image(image_description):
client = OpenAI()
response = client.images.generate(
model="dall-e-3",
prompt=f"{image_description}",
size="1024x1024",
quality="standard",
n=1,
)
img_url = response.data[0].url
return img_url
st.set_page_config(page_title="DALL.E 3 Image Generation")
openai.api_key = apikey
st.title('DALL.E 3 Image Generation')
st.subheader("Powered by OpenAI and Streamlit")
img_description = st.text_input('Image Desription')
if st.button('Generate Image'):
generated_img = generate_image(img_description)
st.image(generated_img)