Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -96,7 +96,8 @@ def create_bibtex_entry(data):
|
|
| 96 |
value = remove_punctuation(value)
|
| 97 |
if key == 'pages':
|
| 98 |
value = value.replace('p. ', '')
|
| 99 |
-
|
|
|
|
| 100 |
bibtex = bibtex.rstrip(',\n') + "\n}"
|
| 101 |
return bibtex
|
| 102 |
|
|
@@ -116,6 +117,8 @@ class CombinedProcessor:
|
|
| 116 |
bibtex_entries = []
|
| 117 |
for entry in bibliography_entries:
|
| 118 |
entry = re.sub(r'\s*([;:])\s*', r' \1 ', entry)
|
|
|
|
|
|
|
| 119 |
bib_out = bibliography_classifier(entry)
|
| 120 |
bib_df = pd.DataFrame(bib_out)
|
| 121 |
|
|
@@ -147,9 +150,6 @@ class CombinedProcessor:
|
|
| 147 |
# Create the processor instance
|
| 148 |
processor = CombinedProcessor()
|
| 149 |
|
| 150 |
-
# Define the Gradio interface
|
| 151 |
-
# ... (previous parts of the script remain unchanged)
|
| 152 |
-
|
| 153 |
# Define the Gradio interface
|
| 154 |
with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
| 155 |
gr.HTML("""<h1 style="text-align:center">Reversed Zotero 2</h1>""")
|
|
|
|
| 96 |
value = remove_punctuation(value)
|
| 97 |
if key == 'pages':
|
| 98 |
value = value.replace('p. ', '')
|
| 99 |
+
if key != "separator":
|
| 100 |
+
bibtex += f" {key.lower()} = {{{value.strip()}}},\n"
|
| 101 |
bibtex = bibtex.rstrip(',\n') + "\n}"
|
| 102 |
return bibtex
|
| 103 |
|
|
|
|
| 117 |
bibtex_entries = []
|
| 118 |
for entry in bibliography_entries:
|
| 119 |
entry = re.sub(r'\s*([;:])\s*', r' \1 ', entry)
|
| 120 |
+
entry = re.sub(r'- ?[\n¶] ?', r'', entry)
|
| 121 |
+
entry = re.sub(r' ?[\n¶] ?', r' ', entry)
|
| 122 |
bib_out = bibliography_classifier(entry)
|
| 123 |
bib_df = pd.DataFrame(bib_out)
|
| 124 |
|
|
|
|
| 150 |
# Create the processor instance
|
| 151 |
processor = CombinedProcessor()
|
| 152 |
|
|
|
|
|
|
|
|
|
|
| 153 |
# Define the Gradio interface
|
| 154 |
with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
| 155 |
gr.HTML("""<h1 style="text-align:center">Reversed Zotero 2</h1>""")
|