File size: 803 Bytes
a235177
1748047
a235177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
import xmltodict
import requests
def search(q,rn)
    r=requests.get(s_url.replace("SQ",q).replace("MR",str(rn)))
    cont=xmltodict.parse(r.content)['feed']['entry']
    html=""
    for i,c in enumerate(cont):
        pdflink=c['id'].replace('/abs/','/pdf/')
        html+=f"<div class='card_div' id='id{i}' onclick='fun_run()'>"
        html+=f"<div class='titlebase'>{c['title']}</div>"
        html+=f"<div>{c['summary']}</div>"
        html+=f"<div><a href='{pdflink}' target='_blank'>{pdflink}</a></div>"
        html+="</div>"
    return(json.dumps(cont,indent=4)),html
with gr.Blocks() as b:
    with gr.Query():
        with gr.Row():
            query=gr.Textbox(label="Query")
            num=gr.Number(label="Count",step=1,value=10)
            sub=gr.Button()
b.launch()