Spaces:
Runtime error
Runtime error
gchhablani
commited on
Commit
•
97b0cf1
1
Parent(s):
16d2b2d
Change layout
Browse files
app.py
CHANGED
@@ -96,15 +96,6 @@ if state.image_file is None:
|
|
96 |
|
97 |
# col1, col2 = st.beta_columns([6, 4])
|
98 |
|
99 |
-
if st.button("Get a random example", help="Get a random example from one of the seeded examples."):
|
100 |
-
sample = dummy_data.sample(1).reset_index()
|
101 |
-
state.image_file = sample.loc[0, "image_file"]
|
102 |
-
state.caption = sample.loc[0, "caption"].strip("- ")
|
103 |
-
|
104 |
-
image_path = os.path.join("images", state.image_file)
|
105 |
-
image = plt.imread(image_path)
|
106 |
-
state.image = image
|
107 |
-
|
108 |
# col2.write("OR")
|
109 |
|
110 |
# uploaded_file = col2.file_uploader("Upload your image", type=["png", "jpg", "jpeg"])
|
@@ -118,7 +109,15 @@ new_col1, new_col2 = st.beta_columns([5,5])
|
|
118 |
# Display Image
|
119 |
new_col1.image(state.image, use_column_width="always")
|
120 |
|
|
|
|
|
|
|
|
|
121 |
|
|
|
|
|
|
|
|
|
122 |
# Display Reference Caption
|
123 |
new_col2.write("**Reference Caption**: " + state.caption)
|
124 |
new_col2.markdown(
|
|
|
96 |
|
97 |
# col1, col2 = st.beta_columns([6, 4])
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
# col2.write("OR")
|
100 |
|
101 |
# uploaded_file = col2.file_uploader("Upload your image", type=["png", "jpg", "jpeg"])
|
|
|
109 |
# Display Image
|
110 |
new_col1.image(state.image, use_column_width="always")
|
111 |
|
112 |
+
if new_col2.button("Get a random example", help="Get a random example from one of the seeded examples."):
|
113 |
+
sample = dummy_data.sample(1).reset_index()
|
114 |
+
state.image_file = sample.loc[0, "image_file"]
|
115 |
+
state.caption = sample.loc[0, "caption"].strip("- ")
|
116 |
|
117 |
+
image_path = os.path.join("images", state.image_file)
|
118 |
+
image = plt.imread(image_path)
|
119 |
+
state.image = image
|
120 |
+
|
121 |
# Display Reference Caption
|
122 |
new_col2.write("**Reference Caption**: " + state.caption)
|
123 |
new_col2.markdown(
|