Spaces:
Runtime error
Runtime error
Commit
·
a3345ad
1
Parent(s):
a074c91
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from diffusers import DiffusionPipeline
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import requests
|
| 5 |
+
from io import BytesIO
|
| 6 |
+
|
| 7 |
+
st.title('Image Generation App')
|
| 8 |
+
pipeline = DiffusionPipeline.from_pretrained("dataautogpt3/OpenDalleV1.1")
|
| 9 |
+
|
| 10 |
+
prompt = st.text_input('Enter prompt', '')
|
| 11 |
+
|
| 12 |
+
if st.button('Generate'):
|
| 13 |
+
results = []
|
| 14 |
+
for _ in range(4):
|
| 15 |
+
response = requests.post(pipeline, json={"prompt": prompt})
|
| 16 |
+
image_bytes = BytesIO(response.content)
|
| 17 |
+
img = Image.open(image_bytes)
|
| 18 |
+
results.append(img)
|
| 19 |
+
|
| 20 |
+
for img in results:
|
| 21 |
+
st.image(img, use_column_width=True, caption='Generated Image')
|