Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,8 +62,7 @@ def search(q,rn,st):
|
|
| 62 |
return(json.dumps(cont,indent=4)),html
|
| 63 |
def next_show(cur):
|
| 64 |
new=int(cur)+10
|
| 65 |
-
|
| 66 |
-
return gr.update(visible=True),html_out,new
|
| 67 |
|
| 68 |
def prev_show(cur):
|
| 69 |
if int(cur)-10 <=0:
|
|
@@ -72,8 +71,11 @@ def prev_show(cur):
|
|
| 72 |
else:
|
| 73 |
new=int(cur)-10
|
| 74 |
out_gr=gr.update(visible=True)
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
with gr.Blocks(css=style,head=head) as b:
|
| 79 |
with gr.Group():
|
|
@@ -90,8 +92,8 @@ with gr.Blocks(css=style,head=head) as b:
|
|
| 90 |
|
| 91 |
hid_start=gr.Number(step=1,value=0,visible=True)
|
| 92 |
|
| 93 |
-
next_btn.click(next_show,[hid_start],[prev_btn,
|
| 94 |
-
prev_btn.click(next_show,[hid_start],[prev_btn,
|
| 95 |
|
| 96 |
-
sub.click(search,[query,num,hid_start],[json_out,html_out])
|
| 97 |
b.launch()
|
|
|
|
| 62 |
return(json.dumps(cont,indent=4)),html
|
| 63 |
def next_show(cur):
|
| 64 |
new=int(cur)+10
|
| 65 |
+
return gr.update(visible=True),new
|
|
|
|
| 66 |
|
| 67 |
def prev_show(cur):
|
| 68 |
if int(cur)-10 <=0:
|
|
|
|
| 71 |
else:
|
| 72 |
new=int(cur)-10
|
| 73 |
out_gr=gr.update(visible=True)
|
| 74 |
+
return out_gr,new
|
| 75 |
+
def show_num(cur):
|
| 76 |
+
new=int(cur)+10
|
| 77 |
+
html_out=f"<div>Showing {cur} through {new}</div>"
|
| 78 |
+
return html_out
|
| 79 |
|
| 80 |
with gr.Blocks(css=style,head=head) as b:
|
| 81 |
with gr.Group():
|
|
|
|
| 92 |
|
| 93 |
hid_start=gr.Number(step=1,value=0,visible=True)
|
| 94 |
|
| 95 |
+
next_btn.click(next_show,[hid_start],[prev_btn,hid_start]).then(show_num,hid_start,show_html).then(search,[query,num,hid_start],[json_out,html_out])
|
| 96 |
+
prev_btn.click(next_show,[hid_start],[prev_btn,hid_start]).then(show_num,hid_start,show_html).then(search,[query,num,hid_start],[json_out,html_out])
|
| 97 |
|
| 98 |
+
sub.click(search,[query,num,hid_start],[json_out,html_out]).then(show_num,hid_start,show_html)
|
| 99 |
b.launch()
|