Spaces:
Running
Running
ok
Browse files
app.py
CHANGED
|
@@ -12,103 +12,104 @@ paper_central_df = PaperCentral()
|
|
| 12 |
with gr.Blocks(css="style.css") as demo:
|
| 13 |
gr.Markdown("# Paper Central")
|
| 14 |
|
| 15 |
-
with gr.
|
| 16 |
-
with gr.
|
| 17 |
-
gr.
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
with gr.
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
# Create a row for Hugging Face options and Conference options
|
| 39 |
-
with gr.Row():
|
| 40 |
-
with gr.Column():
|
| 41 |
-
# Define the checkbox group for Hugging Face options
|
| 42 |
-
cat_options = gr.CheckboxGroup(
|
| 43 |
-
label="Category",
|
| 44 |
-
choices=[
|
| 45 |
-
'cs.*',
|
| 46 |
-
'eess.*',
|
| 47 |
-
'econ.*',
|
| 48 |
-
'math.*',
|
| 49 |
-
'astro-ph.*',
|
| 50 |
-
'cond-mat.*',
|
| 51 |
-
'gr-qc',
|
| 52 |
-
'hep-ex',
|
| 53 |
-
'hep-lat',
|
| 54 |
-
'hep-ph',
|
| 55 |
-
'hep-th',
|
| 56 |
-
'math-ph',
|
| 57 |
-
'nlin.*',
|
| 58 |
-
'nucl-ex',
|
| 59 |
-
'nucl-th',
|
| 60 |
-
'physics.*',
|
| 61 |
-
'quant-ph',
|
| 62 |
-
'q-bio.*',
|
| 63 |
-
'q-fin.*',
|
| 64 |
-
'stat.*',
|
| 65 |
-
],
|
| 66 |
-
value=["cs.*"]
|
| 67 |
-
)
|
| 68 |
-
hf_options = gr.CheckboxGroup(
|
| 69 |
-
label="Hugging Face options",
|
| 70 |
-
choices=["🤗 artifacts", "datasets", "models", "spaces", "github"],
|
| 71 |
-
value=[],
|
| 72 |
-
elem_id="hf_options"
|
| 73 |
-
)
|
| 74 |
-
|
| 75 |
-
with gr.Column():
|
| 76 |
-
# Define the checkbox group for Conference options
|
| 77 |
-
conference_options = gr.CheckboxGroup(
|
| 78 |
-
label="Conference options",
|
| 79 |
-
choices=["In proceedings"] + PaperCentral.CONFERENCES
|
| 80 |
-
)
|
| 81 |
-
with gr.Row():
|
| 82 |
-
# Define a Textbox for author search
|
| 83 |
-
author_search = gr.Textbox(
|
| 84 |
-
label="Search Authors",
|
| 85 |
-
placeholder="Enter author name",
|
| 86 |
)
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
)
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
|
| 111 |
-
|
| 112 |
|
| 113 |
|
| 114 |
# Define function to move to the next day
|
|
@@ -380,15 +381,17 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 380 |
Returns:
|
| 381 |
str: The echoed text.
|
| 382 |
"""
|
| 383 |
-
calendar = gr.update()
|
| 384 |
-
conferences = gr.update()
|
| 385 |
-
hf_options = gr.update()
|
|
|
|
| 386 |
|
| 387 |
if request:
|
| 388 |
print("Request headers dictionary:", dict(request.headers))
|
| 389 |
print("IP address:", request.client.host)
|
| 390 |
print("Query parameters:", dict(request.query_params))
|
| 391 |
print("Session hash:", request.session_hash)
|
|
|
|
| 392 |
if 'date' in request.query_params:
|
| 393 |
calendar = gr.update(value=request.query_params['date'])
|
| 394 |
|
|
@@ -410,7 +413,12 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 410 |
hf_options = []
|
| 411 |
hf_options = gr.update(value=hf_options)
|
| 412 |
|
| 413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
|
| 415 |
|
| 416 |
demo.load(
|
|
@@ -420,7 +428,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 420 |
api_name=False,
|
| 421 |
).then(
|
| 422 |
fn=echo,
|
| 423 |
-
outputs=[calendar, conference_options, hf_options]
|
| 424 |
)
|
| 425 |
|
| 426 |
|
|
|
|
| 12 |
with gr.Blocks(css="style.css") as demo:
|
| 13 |
gr.Markdown("# Paper Central")
|
| 14 |
|
| 15 |
+
with gr.Tabs() as tabs:
|
| 16 |
+
with gr.Tab("Paper-central", id="tab-paper-central"):
|
| 17 |
+
with gr.Accordion(label="⭐Release notes", open=False):
|
| 18 |
+
gr.Markdown("""
|
| 19 |
+
- 8/10/2024 - MICCAI proceedings added
|
| 20 |
+
- 7/10/2024 - COLM2024 proceedings added
|
| 21 |
+
- 4/10/2024 - You can now filter by Title
|
| 22 |
+
""")
|
| 23 |
+
|
| 24 |
+
# Create a row for navigation buttons and calendar
|
| 25 |
+
with gr.Row():
|
| 26 |
+
with gr.Column(scale=1):
|
| 27 |
+
# Define the 'Next Day' and 'Previous Day' buttons
|
| 28 |
+
next_day_btn = gr.Button("Next Day")
|
| 29 |
+
prev_day_btn = gr.Button("Previous Day")
|
| 30 |
+
with gr.Column(scale=4):
|
| 31 |
+
# Define the calendar component for date selection
|
| 32 |
+
calendar = Calendar(
|
| 33 |
+
type="datetime",
|
| 34 |
+
label="Select a date",
|
| 35 |
+
info="Click the calendar icon to bring up the calendar.",
|
| 36 |
+
value=datetime.today().strftime('%Y-%m-%d') # Default to today's date
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
)
|
| 38 |
+
|
| 39 |
+
# Create a row for Hugging Face options and Conference options
|
| 40 |
+
with gr.Row():
|
| 41 |
+
with gr.Column():
|
| 42 |
+
# Define the checkbox group for Hugging Face options
|
| 43 |
+
cat_options = gr.CheckboxGroup(
|
| 44 |
+
label="Category",
|
| 45 |
+
choices=[
|
| 46 |
+
'cs.*',
|
| 47 |
+
'eess.*',
|
| 48 |
+
'econ.*',
|
| 49 |
+
'math.*',
|
| 50 |
+
'astro-ph.*',
|
| 51 |
+
'cond-mat.*',
|
| 52 |
+
'gr-qc',
|
| 53 |
+
'hep-ex',
|
| 54 |
+
'hep-lat',
|
| 55 |
+
'hep-ph',
|
| 56 |
+
'hep-th',
|
| 57 |
+
'math-ph',
|
| 58 |
+
'nlin.*',
|
| 59 |
+
'nucl-ex',
|
| 60 |
+
'nucl-th',
|
| 61 |
+
'physics.*',
|
| 62 |
+
'quant-ph',
|
| 63 |
+
'q-bio.*',
|
| 64 |
+
'q-fin.*',
|
| 65 |
+
'stat.*',
|
| 66 |
+
],
|
| 67 |
+
value=["cs.*"]
|
| 68 |
+
)
|
| 69 |
+
hf_options = gr.CheckboxGroup(
|
| 70 |
+
label="Hugging Face options",
|
| 71 |
+
choices=["🤗 artifacts", "datasets", "models", "spaces", "github"],
|
| 72 |
+
value=[],
|
| 73 |
+
elem_id="hf_options"
|
| 74 |
)
|
| 75 |
|
| 76 |
+
with gr.Column():
|
| 77 |
+
# Define the checkbox group for Conference options
|
| 78 |
+
conference_options = gr.CheckboxGroup(
|
| 79 |
+
label="Conference options",
|
| 80 |
+
choices=["In proceedings"] + PaperCentral.CONFERENCES
|
| 81 |
+
)
|
| 82 |
+
with gr.Row():
|
| 83 |
+
# Define a Textbox for author search
|
| 84 |
+
author_search = gr.Textbox(
|
| 85 |
+
label="Search Authors",
|
| 86 |
+
placeholder="Enter author name",
|
| 87 |
+
)
|
| 88 |
+
title_search = gr.Textbox(
|
| 89 |
+
label="Search Title",
|
| 90 |
+
placeholder="Enter keywords",
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
# Define the Dataframe component to display paper data
|
| 94 |
+
# List of columns in your DataFrame
|
| 95 |
+
columns = paper_central_df.COLUMNS_START_PAPER_PAGE
|
| 96 |
+
|
| 97 |
+
paper_central_component = gr.Dataframe(
|
| 98 |
+
label="Paper Data",
|
| 99 |
+
value=paper_central_df.df_prettified[columns],
|
| 100 |
+
datatype=[
|
| 101 |
+
paper_central_df.DATATYPES[column]
|
| 102 |
+
for column in columns
|
| 103 |
+
],
|
| 104 |
+
row_count=(0, "dynamic"),
|
| 105 |
+
interactive=False,
|
| 106 |
+
max_height=1000,
|
| 107 |
+
elem_id="table",
|
| 108 |
+
wrap=True,
|
| 109 |
+
)
|
| 110 |
|
| 111 |
+
with gr.Tab("Leaderboards", id="tab-leaderboards"):
|
| 112 |
+
author_leaderboard_tab()
|
| 113 |
|
| 114 |
|
| 115 |
# Define function to move to the next day
|
|
|
|
| 381 |
Returns:
|
| 382 |
str: The echoed text.
|
| 383 |
"""
|
| 384 |
+
calendar = gr.update(datetime.today().strftime('%Y-%m-%d'))
|
| 385 |
+
conferences = gr.update(value=[])
|
| 386 |
+
hf_options = gr.update(value=[])
|
| 387 |
+
leaderboard_tab = gr.Tabs()
|
| 388 |
|
| 389 |
if request:
|
| 390 |
print("Request headers dictionary:", dict(request.headers))
|
| 391 |
print("IP address:", request.client.host)
|
| 392 |
print("Query parameters:", dict(request.query_params))
|
| 393 |
print("Session hash:", request.session_hash)
|
| 394 |
+
|
| 395 |
if 'date' in request.query_params:
|
| 396 |
calendar = gr.update(value=request.query_params['date'])
|
| 397 |
|
|
|
|
| 413 |
hf_options = []
|
| 414 |
hf_options = gr.update(value=hf_options)
|
| 415 |
|
| 416 |
+
if "tab" in request.query_params:
|
| 417 |
+
tab = request.query_params['tab']
|
| 418 |
+
if tab == "tab-leaderboards":
|
| 419 |
+
leaderboard_tab = gr.Tabs(selected="tab-leaderboards")
|
| 420 |
+
|
| 421 |
+
return calendar, conferences, hf_options, leaderboard_tab
|
| 422 |
|
| 423 |
|
| 424 |
demo.load(
|
|
|
|
| 428 |
api_name=False,
|
| 429 |
).then(
|
| 430 |
fn=echo,
|
| 431 |
+
outputs=[calendar, conference_options, hf_options, tabs]
|
| 432 |
)
|
| 433 |
|
| 434 |
|