Spaces:
Runtime error
Runtime error
(Bill) Yuchen Lin
commited on
Commit
•
d39adb8
1
Parent(s):
8746fcc
download button
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ def process(input_bib, shorten, remove_keys, deduplicate, sort):
|
|
36 |
output_bib = f.read().replace("\n ", "\n ")
|
37 |
# delete both files
|
38 |
# print(output_bib)
|
39 |
-
return output_bib
|
40 |
|
41 |
|
42 |
example_input = """
|
@@ -67,7 +67,6 @@ with gr.Blocks() as demo:
|
|
67 |
|
68 |
gr.Markdown(
|
69 |
'''# Rebiber: A tool for normalizing bibtex with official info.
|
70 |
-
|
71 |
<table>
|
72 |
<tr>
|
73 |
<td>
|
@@ -87,11 +86,10 @@ with gr.Blocks() as demo:
|
|
87 |
</td>
|
88 |
</tr>
|
89 |
</table>
|
90 |
-
|
91 |
We often cite papers using their arXiv versions without noting that they are already __PUBLISHED__ in some conferences. These unofficial bib entries might violate rules about submissions or camera-ready versions for some conferences.
|
92 |
We introduce __Rebiber__, a simple tool in Python to fix them automatically. It is based on the official conference information from the [DBLP](https://dblp.org/) or [the ACL anthology](https://www.aclweb.org/anthology/) (for NLP conferences)!
|
93 |
-
Apart from handling outdated arXiv citations, __Rebiber__ also normalizes citations in a unified way (DBLP-style), supporting abbreviation and value selection.
|
94 |
-
Note that you can copy the output bib file by clicking the top-right button.
|
95 |
'''
|
96 |
)
|
97 |
|
@@ -101,14 +99,30 @@ with gr.Blocks() as demo:
|
|
101 |
removekeys = gr.CheckboxGroup(["url", "biburl", "address", "publisher", "pages", "doi", "volume", "bibsource"],
|
102 |
value=[False, False, False, False, False, False, False, False],
|
103 |
label="Remove Keys", info="Which keys to remove?")
|
104 |
-
shorten = gr.Checkbox(label="Abbreviation", info="Shorten the conference/journal names (e.g., `Proceedings of the 2020 International Conference of ...` --> `Proc. of ICML')", value=False)
|
105 |
dedup = gr.Checkbox(label="Deduplicate entries.", value=False)
|
106 |
sort = gr.Checkbox(label="Sort alphabetically by ID.", value=False)
|
107 |
-
|
|
|
|
|
|
|
|
|
108 |
with gr.Column(scale=3):
|
109 |
-
output=gr.
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
# gr.Interface(fn=process,
|
113 |
# outputs=gr.outputs.Textbox(label="Output BIB").style(show_copy_button=True),
|
114 |
# examples=examples,
|
|
|
36 |
output_bib = f.read().replace("\n ", "\n ")
|
37 |
# delete both files
|
38 |
# print(output_bib)
|
39 |
+
return output_bib, random_id
|
40 |
|
41 |
|
42 |
example_input = """
|
|
|
67 |
|
68 |
gr.Markdown(
|
69 |
'''# Rebiber: A tool for normalizing bibtex with official info.
|
|
|
70 |
<table>
|
71 |
<tr>
|
72 |
<td>
|
|
|
86 |
</td>
|
87 |
</tr>
|
88 |
</table>
|
89 |
+
|
90 |
We often cite papers using their arXiv versions without noting that they are already __PUBLISHED__ in some conferences. These unofficial bib entries might violate rules about submissions or camera-ready versions for some conferences.
|
91 |
We introduce __Rebiber__, a simple tool in Python to fix them automatically. It is based on the official conference information from the [DBLP](https://dblp.org/) or [the ACL anthology](https://www.aclweb.org/anthology/) (for NLP conferences)!
|
92 |
+
Apart from handling outdated arXiv citations, __Rebiber__ also normalizes citations in a unified way (DBLP-style), supporting abbreviation and value selection.
|
|
|
93 |
'''
|
94 |
)
|
95 |
|
|
|
99 |
removekeys = gr.CheckboxGroup(["url", "biburl", "address", "publisher", "pages", "doi", "volume", "bibsource"],
|
100 |
value=[False, False, False, False, False, False, False, False],
|
101 |
label="Remove Keys", info="Which keys to remove?")
|
102 |
+
shorten = gr.Checkbox(label="Abbreviation", info="Shorten the conference/journal names (e.g., `Proceedings of the 2020 International Conference of ...` --> `Proc. of ICML')", value=False)
|
103 |
dedup = gr.Checkbox(label="Deduplicate entries.", value=False)
|
104 |
sort = gr.Checkbox(label="Sort alphabetically by ID.", value=False)
|
105 |
+
with gr.Row():
|
106 |
+
clr_button = gr.Button("Clear")
|
107 |
+
button = gr.Button("Submit")
|
108 |
+
ex_uuid = gr.Text(label="UUID")
|
109 |
+
ex_uuid.visible = False
|
110 |
with gr.Column(scale=3):
|
111 |
+
output=gr.Textbox(label="Output BIB (Note that you can copy the output bib file by clicking the top-right button.)").style(show_copy_button=True, interactive=False)
|
112 |
+
download_btn = gr.Button("Download")
|
113 |
+
download_content = gr.outputs.File()
|
114 |
+
download_content.visible = False
|
115 |
+
def download_file(ex_uuid):
|
116 |
+
global download_content
|
117 |
+
# Replace this with your code to generate/download the file
|
118 |
+
file_path = f"output_{ex_uuid}.bib"
|
119 |
+
download_content.update(visible=False)
|
120 |
+
return file_path, gr.update(visible=True)
|
121 |
+
download_btn.click(download_file, inputs=ex_uuid, outputs=[download_content,download_content])
|
122 |
+
button.click(process, inputs=[input_bib, shorten, removekeys, dedup, sort], outputs=[output, ex_uuid], api_name = "process")
|
123 |
+
def clean(text):
|
124 |
+
return ""
|
125 |
+
clr_button.click(clean, input_bib, input_bib)
|
126 |
# gr.Interface(fn=process,
|
127 |
# outputs=gr.outputs.Textbox(label="Output BIB").style(show_copy_button=True),
|
128 |
# examples=examples,
|