Lisibonny commited on
Commit
3313ec2
1 Parent(s): 36e815a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -14
app.py CHANGED
@@ -123,21 +123,24 @@ def main():
123
  pagination = st.container()
124
  batch_size = 5
125
  total_pages = (int(len(df_results) / batch_size) if int(len(df_results) / batch_size) > 0 else 1)
126
- current_page = st.number_input("Página", min_value=1, max_value=total_pages, step=1)
127
- st.markdown(f"Página **{current_page}** de **{total_pages}** ")
128
 
129
- N_cards_per_row = 1
130
- for n_row, row in df_results.reset_index().iterrows():
131
- i = n_row%N_cards_per_row
132
- if i==0:
133
- st.write("---")
134
- cols = st.columns(N_cards_per_row, gap="large")
135
- # draw the card
136
- with cols[n_row%N_cards_per_row]:
137
- st.caption(f"{row['feed'].strip()} - {row['seccion'].strip()} - {row['fecha'].strip()} ")
138
- st.markdown(f"**{row['titulo'].strip()}**")
139
- st.markdown(f"{row['resumen'].strip()}")
140
- st.markdown(f"{row['link']}")
 
 
 
 
141
  pages = split_frame(df_results, batch_size)
142
  pagination.dataframe(data=pages[current_page - 1], use_container_width=True)
143
 
 
123
  pagination = st.container()
124
  batch_size = 5
125
  total_pages = (int(len(df_results) / batch_size) if int(len(df_results) / batch_size) > 0 else 1)
126
+
 
127
 
128
+ with pagination:
129
+ N_cards_per_row = 1
130
+ for n_row, row in df_results.reset_index().iterrows():
131
+ i = n_row%N_cards_per_row
132
+ if i==0:
133
+ st.write("---")
134
+ cols = st.columns(N_cards_per_row, gap="large")
135
+ # draw the card
136
+ with cols[n_row%N_cards_per_row]:
137
+ st.caption(f"{row['feed'].strip()} - {row['seccion'].strip()} - {row['fecha'].strip()} ")
138
+ st.markdown(f"**{row['titulo'].strip()}**")
139
+ st.markdown(f"{row['resumen'].strip()}")
140
+ st.markdown(f"{row['link']}")
141
+
142
+ current_page = st.number_input("Página", min_value=1, max_value=total_pages, step=1)
143
+ st.markdown(f"Página **{current_page}** de **{total_pages}** ")
144
  pages = split_frame(df_results, batch_size)
145
  pagination.dataframe(data=pages[current_page - 1], use_container_width=True)
146