Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,7 +74,7 @@ def create_bibtex_entry(data):
|
|
| 74 |
if 'journal' in data:
|
| 75 |
entry_type = 'article'
|
| 76 |
elif 'booktitle' in data:
|
| 77 |
-
entry_type = '
|
| 78 |
else:
|
| 79 |
entry_type = 'book'
|
| 80 |
|
|
@@ -138,17 +138,18 @@ class CombinedProcessor:
|
|
| 138 |
bibtex_entry = create_bibtex_entry(bibtex_data)
|
| 139 |
bibtex_entries.append(bibtex_entry)
|
| 140 |
|
| 141 |
-
|
|
|
|
| 142 |
|
| 143 |
# Create the processor instance
|
| 144 |
processor = CombinedProcessor()
|
| 145 |
|
| 146 |
# Define the Gradio interface
|
| 147 |
with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
| 148 |
-
gr.HTML("""<h1 style="text-align:center">
|
| 149 |
text_input = gr.Textbox(label="Your text", type="text", lines=10)
|
| 150 |
text_button = gr.Button("Process Text")
|
| 151 |
-
bibtex_output = gr.
|
| 152 |
text_button.click(processor.process, inputs=text_input, outputs=[bibtex_output])
|
| 153 |
|
| 154 |
if __name__ == "__main__":
|
|
|
|
| 74 |
if 'journal' in data:
|
| 75 |
entry_type = 'article'
|
| 76 |
elif 'booktitle' in data:
|
| 77 |
+
entry_type = 'inproceedings'
|
| 78 |
else:
|
| 79 |
entry_type = 'book'
|
| 80 |
|
|
|
|
| 138 |
bibtex_entry = create_bibtex_entry(bibtex_data)
|
| 139 |
bibtex_entries.append(bibtex_entry)
|
| 140 |
|
| 141 |
+
# Join BibTeX entries with double line breaks for better readability
|
| 142 |
+
return "\n\n".join(bibtex_entries)
|
| 143 |
|
| 144 |
# Create the processor instance
|
| 145 |
processor = CombinedProcessor()
|
| 146 |
|
| 147 |
# Define the Gradio interface
|
| 148 |
with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
| 149 |
+
gr.HTML("""<h1 style="text-align:center">Reverse Zotero 2</h1>""")
|
| 150 |
text_input = gr.Textbox(label="Your text", type="text", lines=10)
|
| 151 |
text_button = gr.Button("Process Text")
|
| 152 |
+
bibtex_output = gr.Code(label="BibTeX Entries", language="bibtex")
|
| 153 |
text_button.click(processor.process, inputs=text_input, outputs=[bibtex_output])
|
| 154 |
|
| 155 |
if __name__ == "__main__":
|