Spaces:
Running
Running
feat(app): improve display
Browse filesFormer-commit-id: e767901c096aa83f85191f9181339eee6e190206
- app/app.py +10 -6
app/app.py
CHANGED
@@ -7,15 +7,16 @@ from dalle_mini.helpers import captioned_strip
|
|
7 |
|
8 |
import streamlit as st
|
9 |
|
10 |
-
# Controls
|
11 |
-
|
12 |
-
# num_images = st.sidebar.slider("Candidates to generate", 1, 64, 8, 1)
|
13 |
-
# num_preds = st.sidebar.slider("Best predictions to show", 1, 8, 1, 1)
|
14 |
|
15 |
st.sidebar.markdown('Visit [our report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini--Vmlldzo4NjIxODA)')
|
16 |
|
|
|
|
|
|
|
17 |
prompt = st.text_input("What do you want to see?")
|
18 |
|
|
|
|
|
19 |
if prompt != "":
|
20 |
st.write(f"Generating candidates for: {prompt}")
|
21 |
|
@@ -23,8 +24,11 @@ if prompt != "":
|
|
23 |
backend_url = st.secrets["BACKEND_SERVER"]
|
24 |
print(f"Getting selections: {prompt}")
|
25 |
selected = get_images_from_backend(prompt, backend_url)
|
26 |
-
|
27 |
-
st.
|
|
|
|
|
|
|
28 |
except ServiceError as error:
|
29 |
st.write(f"Service unavailable, status: {error.status_code}")
|
30 |
except KeyError:
|
|
|
7 |
|
8 |
import streamlit as st
|
9 |
|
|
|
|
|
|
|
|
|
10 |
|
11 |
st.sidebar.markdown('Visit [our report](https://wandb.ai/dalle-mini/dalle-mini/reports/DALL-E-mini--Vmlldzo4NjIxODA)')
|
12 |
|
13 |
+
st.header('DALL-E mini')
|
14 |
+
st.subheader('Generate images from a text prompt')
|
15 |
+
|
16 |
prompt = st.text_input("What do you want to see?")
|
17 |
|
18 |
+
#TODO: I think there's an issue where we can't run twice the same inference (not due to caching) - may need to use st.form
|
19 |
+
|
20 |
if prompt != "":
|
21 |
st.write(f"Generating candidates for: {prompt}")
|
22 |
|
|
|
24 |
backend_url = st.secrets["BACKEND_SERVER"]
|
25 |
print(f"Getting selections: {prompt}")
|
26 |
selected = get_images_from_backend(prompt, backend_url)
|
27 |
+
|
28 |
+
cols = st.beta_columns(4)
|
29 |
+
for i, img in enumerate(selected):
|
30 |
+
cols[i%4].image(img)
|
31 |
+
|
32 |
except ServiceError as error:
|
33 |
st.write(f"Service unavailable, status: {error.status_code}")
|
34 |
except KeyError:
|