Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,18 +16,19 @@ style="""
|
|
| 16 |
padding: 15px;
|
| 17 |
border-radius: 5px;
|
| 18 |
}
|
|
|
|
|
|
|
|
|
|
| 19 |
"""
|
| 20 |
|
| 21 |
head = """
|
| 22 |
<script>
|
| 23 |
function run(inn) {
|
| 24 |
console.log(inn);
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
</div>''')
|
| 30 |
-
return gr.HTML.update(f'''{html_src}''')
|
| 31 |
}
|
| 32 |
</script>
|
| 33 |
""".replace("/abs/","/pdf/")
|
|
@@ -38,11 +39,12 @@ def search(q,rn):
|
|
| 38 |
html=""
|
| 39 |
for i,c in enumerate(cont):
|
| 40 |
pdflink=c['id'].replace('/abs/','/pdf/')
|
| 41 |
-
html+=f"""<div class='card_div' id='id{i}' onclick="run({
|
| 42 |
html+=f"<div class='title_div'>{c['title']}</div>"
|
| 43 |
html+=f"<div style='color:white;'>{c['summary']}</div>"
|
| 44 |
html+=f"<div><a href='{pdflink}' target='_blank'>{pdflink}</a></div>"
|
| 45 |
html+="</div>"
|
|
|
|
| 46 |
return(json.dumps(cont,indent=4)),html
|
| 47 |
with gr.Blocks(css=style,head=head) as b:
|
| 48 |
with gr.Group():
|
|
|
|
| 16 |
padding: 15px;
|
| 17 |
border-radius: 5px;
|
| 18 |
}
|
| 19 |
+
.frame_class{
|
| 20 |
+
display:None;
|
| 21 |
+
}
|
| 22 |
"""
|
| 23 |
|
| 24 |
head = """
|
| 25 |
<script>
|
| 26 |
function run(inn) {
|
| 27 |
console.log(inn);
|
| 28 |
+
var frame_on = document.getElementById("frame" + String(inn));
|
| 29 |
+
/*frame_on.style.display = null;*/
|
| 30 |
+
frame_on.style.display = block;
|
| 31 |
+
|
|
|
|
|
|
|
| 32 |
}
|
| 33 |
</script>
|
| 34 |
""".replace("/abs/","/pdf/")
|
|
|
|
| 39 |
html=""
|
| 40 |
for i,c in enumerate(cont):
|
| 41 |
pdflink=c['id'].replace('/abs/','/pdf/')
|
| 42 |
+
html+=f"""<div class='card_div' id='id{i}' onclick="run({i})">"""
|
| 43 |
html+=f"<div class='title_div'>{c['title']}</div>"
|
| 44 |
html+=f"<div style='color:white;'>{c['summary']}</div>"
|
| 45 |
html+=f"<div><a href='{pdflink}' target='_blank'>{pdflink}</a></div>"
|
| 46 |
html+="</div>"
|
| 47 |
+
html+=f"""<div id=frame{i} class='frame_class'><iframe src="https://docs.google.com/viewer?url={c['id'].replace('/abs/','/pdf/')}&embedded=true" frameborder="0" height="1200px" width="100%"></iframe>"""
|
| 48 |
return(json.dumps(cont,indent=4)),html
|
| 49 |
with gr.Blocks(css=style,head=head) as b:
|
| 50 |
with gr.Group():
|