|
import gradio as gr |
|
from fetch_paper_data import fetch_paper_data |
|
|
|
theme = gr.themes.Soft( |
|
primary_hue="purple", |
|
secondary_hue="cyan", |
|
neutral_hue="slate", |
|
font=[ |
|
gr.themes.GoogleFont('Syne'), |
|
gr.themes.GoogleFont('Poppins'), |
|
gr.themes.GoogleFont('Poppins'), |
|
gr.themes.GoogleFont('Poppins') |
|
], |
|
) |
|
|
|
def clear_data(id, raw_data): |
|
id = None |
|
raw_data = None |
|
return id, raw_data |
|
|
|
with gr.Blocks(theme=theme, title="Fetch Research Paper Data") as app: |
|
with gr.Row(): |
|
with gr.Column(): |
|
id = gr.Textbox(label="Enter PMCID or arXiv ID", placeholder="PMC1234567 or 1234.56789") |
|
with gr.Row(): |
|
fetch_data_btn = gr.Button(value="Fetch Data") |
|
reset_btn = gr.Button(value="Reset") |
|
raw_data = gr.Textbox(lines=15, label="Raw Data", interactive=False, show_copy_button=True) |
|
fetch_data_btn.click(fn=fetch_paper_data, inputs=[id], outputs=[raw_data], api_name="fetch_paper_data") |
|
reset_btn.click(fn=clear_data, inputs=[id, raw_data], outputs=[id, raw_data]) |
|
|
|
app.queue(default_concurrency_limit=25).launch(show_api=True, max_threads=500, ssr_mode=False) |
|
|