Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import arxiv
|
|
|
3 |
|
4 |
search = arxiv.Search(
|
5 |
query = "cs.LG",
|
@@ -7,9 +8,17 @@ search = arxiv.Search(
|
|
7 |
sort_by = arxiv.SortCriterion.SubmittedDate
|
8 |
)
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
with gr.Blocks() as demo:
|
11 |
gr.Markdown("<center><h1>My ArXiv</h1></center>")
|
12 |
-
gr.
|
13 |
with gr.Column():
|
14 |
for arxiv_paper in search.results():
|
15 |
with gr.Column():
|
@@ -17,8 +26,10 @@ with gr.Blocks() as demo:
|
|
17 |
gr.Markdown("<center><h3>" + arxiv_paper.title + "</h3></center>")
|
18 |
gr.Markdown(arxiv_paper.summary)
|
19 |
with gr.Row():
|
20 |
-
|
|
|
21 |
#button.click(flip_image, inputs=image_input, outputs=image_output)
|
22 |
-
gr.Button("Less like this! π")
|
|
|
23 |
|
24 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import arxiv
|
3 |
+
from datasets import load_dataset
|
4 |
|
5 |
search = arxiv.Search(
|
6 |
query = "cs.LG",
|
|
|
8 |
sort_by = arxiv.SortCriterion.SubmittedDate
|
9 |
)
|
10 |
|
11 |
+
#HF_TOKEN = os.getenv("HF_TOKEN") # might use in the future
|
12 |
+
|
13 |
+
def hf_data_upload(user_id, paper_id, feedback):
|
14 |
+
ds = load_dataset("CShorten/Last-Week-on-ArXiv")
|
15 |
+
new_row = {"user_id": user_id, "paper_id": paper_id, "feedback": feedback}
|
16 |
+
ds = ds.add_item(new_row)
|
17 |
+
ds.push_to_hub("CShorten/Last-Week-on-ArXiv")
|
18 |
+
|
19 |
with gr.Blocks() as demo:
|
20 |
gr.Markdown("<center><h1>My ArXiv</h1></center>")
|
21 |
+
user_id = gr.Textbox(placeholder="Enter user id for personalization: ")
|
22 |
with gr.Column():
|
23 |
for arxiv_paper in search.results():
|
24 |
with gr.Column():
|
|
|
26 |
gr.Markdown("<center><h3>" + arxiv_paper.title + "</h3></center>")
|
27 |
gr.Markdown(arxiv_paper.summary)
|
28 |
with gr.Row():
|
29 |
+
more_button = gr.Button("More like this! π")
|
30 |
+
more_button.click(hf_data_upload(user_id, arxiv_paper.title, 1)
|
31 |
#button.click(flip_image, inputs=image_input, outputs=image_output)
|
32 |
+
less_button = gr.Button("Less like this! π")
|
33 |
+
less_button.click(hf_data_upload(user_id, arxiv_paper.title, 0)
|
34 |
|
35 |
demo.launch()
|