Update app.py
Browse files
app.py
CHANGED
@@ -232,29 +232,12 @@ def interface():
|
|
232 |
dropdown.change(lambda c, ci, l: (1,), inputs=[country_filter, city_filter, language_filter], outputs=[page_state])
|
233 |
dropdown.change(filter_by_fields, inputs=[country_filter, city_filter, language_filter, page_state], outputs=[table_html, page_state, gr.Number(visible=False)])
|
234 |
|
235 |
-
prev_btn.click(
|
236 |
-
|
237 |
-
inputs=[page_state],
|
238 |
-
outputs=[page_state]
|
239 |
-
).then(
|
240 |
-
fn=filter_by_fields,
|
241 |
-
inputs=[country_filter, city_filter, language_filter, page_state],
|
242 |
-
outputs=[table_html, page_state, gr.Number(visible=False)]
|
243 |
-
)
|
244 |
-
|
245 |
|
246 |
-
next_btn.click(
|
247 |
-
|
248 |
-
(filter_by_fields
|
249 |
-
p + 1
|
250 |
-
),
|
251 |
-
inputs=[page_state, country_filter, city_filter, language_filter],
|
252 |
-
outputs=[page_state]
|
253 |
-
).then(
|
254 |
-
fn=filter_by_fields,
|
255 |
-
inputs=[country_filter, city_filter, language_filter, page_state],
|
256 |
-
outputs=[table_html, page_state, gr.Number(visible=False)]
|
257 |
-
)
|
258 |
|
259 |
|
260 |
del_btn = gr.Button("Delete Profile")
|
|
|
232 |
dropdown.change(lambda c, ci, l: (1,), inputs=[country_filter, city_filter, language_filter], outputs=[page_state])
|
233 |
dropdown.change(filter_by_fields, inputs=[country_filter, city_filter, language_filter, page_state], outputs=[table_html, page_state, gr.Number(visible=False)])
|
234 |
|
235 |
+
prev_btn.click(lambda p: max(p - 1, 1), inputs=[page_state], outputs=[page_state])
|
236 |
+
prev_btn.click(filter_by_fields, inputs=[country_filter, city_filter, language_filter, page_state], outputs=[table_html, page_state, gr.Number(visible=False)])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
|
238 |
+
next_btn.click(lambda p, c, ci, l: min((filter_by_fields(c, ci, l, p + 1)[2] - 1) // PAGE_SIZE + 1, p + 1),
|
239 |
+
inputs=[page_state, country_filter, city_filter, language_filter], outputs=[page_state])
|
240 |
+
next_btn.click(filter_by_fields, inputs=[country_filter, city_filter, language_filter, page_state], outputs=[table_html, page_state, gr.Number(visible=False)])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
|
243 |
del_btn = gr.Button("Delete Profile")
|