Refactor imports and consolidate utility functions into utils.py; remove tools.py
2ce7bcb
import gradio as gr | |
from fetch_data import fetch_data | |
from utils import reset_datafiles | |
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') | |
], | |
) | |
with gr.Blocks(theme=theme, title="Fetch Research Paper IDS") as app: | |
with gr.Row(): | |
with gr.Column(): | |
user_access_key = gr.Textbox(label="Access Key", placeholder="Enter your access key", type="password") | |
with gr.Row(): | |
fetch_data_btn = gr.Button(value="Fetch Data") | |
reset_files = gr.Button(value="Reset Files") | |
raw_data = gr.Textbox(lines=15, label="Raw IDs Data", interactive=False, placeholder="IDs starting with PMC are PMC IDs and rest all are Arxiv IDs", show_copy_button=True) | |
fetch_data_btn.click(fn=fetch_data, inputs=[user_access_key], outputs=[raw_data], api_name="fetch_paper_ids") | |
reset_files.click(fn=reset_datafiles, inputs=[user_access_key], outputs=[raw_data], show_api=False) | |
app.queue(default_concurrency_limit=25).launch(show_api=True, max_threads=500, ssr_mode=False) |