Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import xmltodict
|
| 3 |
import requests
|
| 4 |
import json
|
|
|
|
| 5 |
style="""
|
| 6 |
.title_div{
|
| 7 |
font-size: x-large;
|
|
@@ -45,6 +46,7 @@ function closefn(inn) {
|
|
| 45 |
}
|
| 46 |
</script>
|
| 47 |
"""
|
|
|
|
| 48 |
def search(q,rn,st):
|
| 49 |
api=f"http://export.arxiv.org/api/query?search_query={str(q)}&start={str(st)}&max_results={str(rn)}"
|
| 50 |
r=requests.get(api)
|
|
@@ -91,7 +93,8 @@ with gr.Blocks(css=style,head=head) as b:
|
|
| 91 |
show_html=gr.HTML()
|
| 92 |
next_btn=gr.Button("Next")
|
| 93 |
html_out=gr.HTML()
|
| 94 |
-
|
|
|
|
| 95 |
hid_start=gr.Number(step=1,value=0,visible=False, interactive=False)
|
| 96 |
|
| 97 |
next_btn.click(next_show,[hid_start],[prev_btn,hid_start]).then(show_num,hid_start,show_html).then(search,[query,num,hid_start],[html_out])
|
|
|
|
| 2 |
import xmltodict
|
| 3 |
import requests
|
| 4 |
import json
|
| 5 |
+
import uuid
|
| 6 |
style="""
|
| 7 |
.title_div{
|
| 8 |
font-size: x-large;
|
|
|
|
| 46 |
}
|
| 47 |
</script>
|
| 48 |
"""
|
| 49 |
+
|
| 50 |
def search(q,rn,st):
|
| 51 |
api=f"http://export.arxiv.org/api/query?search_query={str(q)}&start={str(st)}&max_results={str(rn)}"
|
| 52 |
r=requests.get(api)
|
|
|
|
| 93 |
show_html=gr.HTML()
|
| 94 |
next_btn=gr.Button("Next")
|
| 95 |
html_out=gr.HTML()
|
| 96 |
+
json_out=gr.JSON()
|
| 97 |
+
|
| 98 |
hid_start=gr.Number(step=1,value=0,visible=False, interactive=False)
|
| 99 |
|
| 100 |
next_btn.click(next_show,[hid_start],[prev_btn,hid_start]).then(show_num,hid_start,show_html).then(search,[query,num,hid_start],[html_out])
|