Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -240,9 +240,17 @@ st.title(f'My first app {st.__version__}')
|
|
240 |
tab1, tab2, tab3 = st.tabs(["Data exploration", "Semantic search", "Stats"])
|
241 |
|
242 |
with tab1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
st.dataframe(
|
244 |
-
data=
|
245 |
-
# use_container_width=True,
|
246 |
column_config={
|
247 |
"Download URL": st.column_config.ImageColumn(
|
248 |
"image", help="Instagram image"
|
@@ -254,6 +262,15 @@ with tab1:
|
|
254 |
hide_index=True,
|
255 |
)
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
with tab2:
|
258 |
tabs = ["Text to Text", "Text to Image", "Image to Image", "Image to Text"]
|
259 |
selected_tab = st.radio("Select a search type", tabs)
|
|
|
240 |
tab1, tab2, tab3 = st.tabs(["Data exploration", "Semantic search", "Stats"])
|
241 |
|
242 |
with tab1:
|
243 |
+
rows_per_page = st.sidebar.selectbox('Rows per page', [25, 50, 75, 100, 150, 200], index=0)
|
244 |
+
filtered_df = filter_dataframe(df)
|
245 |
+
max_page = -(-len(filtered_df) // rows_per_page) # ceiling division
|
246 |
+
page_number = st.sidebar.number_input('Page number', min_value=1, max_value=max_page, value=1)
|
247 |
+
|
248 |
+
start_index = rows_per_page * (page_number - 1)
|
249 |
+
end_index = start_index + rows_per_page
|
250 |
+
sub_df = filtered_df.iloc[start_index:end_index]
|
251 |
+
|
252 |
st.dataframe(
|
253 |
+
data=sub_df,
|
|
|
254 |
column_config={
|
255 |
"Download URL": st.column_config.ImageColumn(
|
256 |
"image", help="Instagram image"
|
|
|
262 |
hide_index=True,
|
263 |
)
|
264 |
|
265 |
+
if st.button('Previous'):
|
266 |
+
page_number = max(1, page_number - 1)
|
267 |
+
if st.button('Next'):
|
268 |
+
page_number = min(max_page, page_number + 1)
|
269 |
+
|
270 |
+
page_select = st.selectbox('Jump to page', options=range(1, max_page+1))
|
271 |
+
if page_select != page_number:
|
272 |
+
page_number = page_select
|
273 |
+
|
274 |
with tab2:
|
275 |
tabs = ["Text to Text", "Text to Image", "Image to Image", "Image to Text"]
|
276 |
selected_tab = st.radio("Select a search type", tabs)
|