Spaces:
Build error
Build error
added center column context manager
Browse files
app.py
CHANGED
@@ -32,8 +32,10 @@ def gen_show_caption(sub_prompt=None, cap_prompt = ""):
|
|
32 |
""",
|
33 |
unsafe_allow_html=True)
|
34 |
|
|
|
35 |
|
36 |
-
|
|
|
37 |
st.sidebar.markdown(
|
38 |
"""
|
39 |
### Image Captioning Model from VirTex trained on RedCaps
|
@@ -50,12 +52,6 @@ with st.spinner("Loading Model"):
|
|
50 |
virtexModel, imageLoader, sample_images, valid_subs = create_objects()
|
51 |
|
52 |
|
53 |
-
# staggered = st.sidebar.checkbox("Iteratively Generate Captions")
|
54 |
-
|
55 |
-
# if staggered:
|
56 |
-
# pass
|
57 |
-
# else:
|
58 |
-
|
59 |
select_idx = None
|
60 |
|
61 |
st.sidebar.title("Select a sample image")
|
@@ -129,10 +125,10 @@ image_dict = imageLoader.transform(image)
|
|
129 |
show_image = imageLoader.show_resize(image)
|
130 |
|
131 |
show = st.image(show_image)
|
132 |
-
show.image(show_image
|
133 |
-
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
32 |
""",
|
33 |
unsafe_allow_html=True)
|
34 |
|
35 |
+
_, center, _ = st.columns(3)
|
36 |
|
37 |
+
with center:
|
38 |
+
st.title("Image Captioning Demo from RedCaps")
|
39 |
st.sidebar.markdown(
|
40 |
"""
|
41 |
### Image Captioning Model from VirTex trained on RedCaps
|
|
|
52 |
virtexModel, imageLoader, sample_images, valid_subs = create_objects()
|
53 |
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
select_idx = None
|
56 |
|
57 |
st.sidebar.title("Select a sample image")
|
|
|
125 |
show_image = imageLoader.show_resize(image)
|
126 |
|
127 |
show = st.image(show_image)
|
128 |
+
show.image(show_image)
|
|
|
129 |
|
130 |
+
with center:
|
131 |
+
if sub is None and imageLoader.text_transform(cap_prompt) is not "":
|
132 |
+
st.write("Without a specified subreddit we default to /r/pics")
|
133 |
+
for i in range(num_captions):
|
134 |
+
gen_show_caption(sub, imageLoader.text_transform(cap_prompt))
|