zamborg commited on
Commit
0ae57d5
·
1 Parent(s): 91de8a4

added center column context manager

Browse files
Files changed (1) hide show
  1. app.py +9 -13
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
- st.title("Image Captioning Demo from RedCaps")
 
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, "Your Image")
133
-
134
 
135
- if sub is None and imageLoader.text_transform(cap_prompt) is not "":
136
- st.write("Without a specified subreddit we default to /r/pics")
137
- for i in range(num_captions):
138
- gen_show_caption(sub, imageLoader.text_transform(cap_prompt))
 
 
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))