Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -53,6 +53,9 @@ def fetch_arxiv_data(arxiv_id):
|
|
53 |
|
54 |
def update_fields(url_or_id):
|
55 |
arxiv_id = extract_arxiv_id(url_or_id)
|
|
|
|
|
|
|
56 |
title, authors, abstract = fetch_arxiv_data(arxiv_id)
|
57 |
return title, authors, abstract
|
58 |
|
@@ -104,7 +107,7 @@ with gr.Blocks() as demo:
|
|
104 |
author_box = gr.Textbox(label="Authors (separated by comma)", placeholder="Enter authors (separated by comma)", value=example_authors)
|
105 |
abstract_box = gr.TextArea(label="Abstract", placeholder="Enter abstract", value=example_abstract)
|
106 |
arxiv_box = gr.Textbox(label="[Optional] Autofill using arXiv URL/ID", placeholder="[Optional] Autofill using arXiv URL/ID")
|
107 |
-
arxiv_box.input(update_fields, inputs=[arxiv_box], outputs=[title_box, author_box, abstract_box])
|
108 |
|
109 |
iface = gr.Interface(
|
110 |
fn=predict,
|
@@ -114,5 +117,7 @@ with gr.Blocks() as demo:
|
|
114 |
description="Predict if @_akhaliq will select your paper into Hugging Face papers. Enter the title, authors, and abstract of your paper, or enter an arXiv URL/ID.",
|
115 |
live=False,
|
116 |
)
|
|
|
|
|
117 |
|
118 |
-
demo.queue(
|
|
|
53 |
|
54 |
def update_fields(url_or_id):
|
55 |
arxiv_id = extract_arxiv_id(url_or_id)
|
56 |
+
if len(arxiv_id.strip().split('.')) != 2:
|
57 |
+
return '', '', ''
|
58 |
+
print (arxiv_id)
|
59 |
title, authors, abstract = fetch_arxiv_data(arxiv_id)
|
60 |
return title, authors, abstract
|
61 |
|
|
|
107 |
author_box = gr.Textbox(label="Authors (separated by comma)", placeholder="Enter authors (separated by comma)", value=example_authors)
|
108 |
abstract_box = gr.TextArea(label="Abstract", placeholder="Enter abstract", value=example_abstract)
|
109 |
arxiv_box = gr.Textbox(label="[Optional] Autofill using arXiv URL/ID", placeholder="[Optional] Autofill using arXiv URL/ID")
|
110 |
+
#arxiv_box.input(update_fields, inputs=[arxiv_box], outputs=[title_box, author_box, abstract_box])
|
111 |
|
112 |
iface = gr.Interface(
|
113 |
fn=predict,
|
|
|
117 |
description="Predict if @_akhaliq will select your paper into Hugging Face papers. Enter the title, authors, and abstract of your paper, or enter an arXiv URL/ID.",
|
118 |
live=False,
|
119 |
)
|
120 |
+
autofill_btn = gr.Button("Autofill using arXiv")
|
121 |
+
autofill_btn.click(update_fields, inputs=[arxiv_box], outputs=[title_box, author_box, abstract_box])
|
122 |
|
123 |
+
demo.queue(concurrency_count=1, max_size=20).launch(enable_queue=True)
|