Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
|
|
5 |
from gradio_calendar import Calendar
|
6 |
|
7 |
from papers import PaperList, get_df
|
@@ -19,6 +20,16 @@ Related useful Spaces:
|
|
19 |
paper_list = PaperList(get_df())
|
20 |
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
def update_num_papers(df: pd.DataFrame) -> str:
|
23 |
return f"{len(df)} / {len(paper_list.df_raw)}"
|
24 |
|
@@ -73,6 +84,13 @@ with gr.Blocks(css="style.css") as demo:
|
|
73 |
queue=False,
|
74 |
api_name=False,
|
75 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
if __name__ == "__main__":
|
78 |
demo.queue(api_open=False).launch(show_api=False)
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
5 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
6 |
from gradio_calendar import Calendar
|
7 |
|
8 |
from papers import PaperList, get_df
|
|
|
20 |
paper_list = PaperList(get_df())
|
21 |
|
22 |
|
23 |
+
def update_paper_list() -> None:
|
24 |
+
global paper_list
|
25 |
+
paper_list = PaperList(get_df())
|
26 |
+
|
27 |
+
|
28 |
+
scheduler = BackgroundScheduler()
|
29 |
+
scheduler.add_job(func=update_paper_list, trigger="cron", hour="*", timezone="UTC", misfire_grace_time=60)
|
30 |
+
scheduler.start()
|
31 |
+
|
32 |
+
|
33 |
def update_num_papers(df: pd.DataFrame) -> str:
|
34 |
return f"{len(df)} / {len(paper_list.df_raw)}"
|
35 |
|
|
|
84 |
queue=False,
|
85 |
api_name=False,
|
86 |
)
|
87 |
+
demo.load(
|
88 |
+
fn=update_num_papers,
|
89 |
+
inputs=df,
|
90 |
+
outputs=num_papers,
|
91 |
+
queue=False,
|
92 |
+
api_name=False,
|
93 |
+
)
|
94 |
|
95 |
if __name__ == "__main__":
|
96 |
demo.queue(api_open=False).launch(show_api=False)
|