File size: 623 Bytes
a3345ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
from diffusers import DiffusionPipeline
from PIL import Image
import requests
from io import BytesIO

st.title('Image Generation App')
pipeline = DiffusionPipeline.from_pretrained("dataautogpt3/OpenDalleV1.1")

prompt = st.text_input('Enter prompt', '')

if st.button('Generate'):
    results = []
    for _ in range(4):
        response = requests.post(pipeline, json={"prompt": prompt})
        image_bytes = BytesIO(response.content)
        img = Image.open(image_bytes)
        results.append(img)

    for img in results:
        st.image(img, use_column_width=True, caption='Generated Image')