Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -180,11 +180,13 @@ def bibtex_to_dict_list(bibtex_string):
|
|
| 180 |
return [dict(entry) for entry in bib_database.entries]
|
| 181 |
|
| 182 |
|
| 183 |
-
def referenceErrorParser(bibtex_string: str):
|
|
|
|
|
|
|
| 184 |
|
| 185 |
-
checker = ConsistencyHandler()
|
| 186 |
entries = bibtex_to_dict_list(bibtex_string)
|
| 187 |
-
|
|
|
|
| 188 |
for entry in entries:
|
| 189 |
|
| 190 |
# article
|
|
@@ -223,6 +225,11 @@ def referenceErrorParser(bibtex_string: str):
|
|
| 223 |
|
| 224 |
else:
|
| 225 |
print(f"{entry['ENTRYTYPE']} has to be added for processing.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
|
| 228 |
outputJson = json.dumps(entries)
|
|
@@ -235,7 +242,10 @@ def create_interface():
|
|
| 235 |
gr.Markdown("# Reference Validation")
|
| 236 |
|
| 237 |
with gr.Row():
|
| 238 |
-
|
|
|
|
|
|
|
|
|
|
| 239 |
|
| 240 |
with gr.Row():
|
| 241 |
analyze_btn = gr.Button("Get Corrections")
|
|
@@ -248,7 +258,7 @@ def create_interface():
|
|
| 248 |
|
| 249 |
analyze_btn.click(
|
| 250 |
fn=referenceErrorParser,
|
| 251 |
-
inputs=
|
| 252 |
outputs=results_output
|
| 253 |
)
|
| 254 |
|
|
|
|
| 180 |
return [dict(entry) for entry in bib_database.entries]
|
| 181 |
|
| 182 |
|
| 183 |
+
def referenceErrorParser(bibtex_string: str, coordinateStr: str):
|
| 184 |
+
|
| 185 |
+
data = json.loads(coordinateStr)
|
| 186 |
|
|
|
|
| 187 |
entries = bibtex_to_dict_list(bibtex_string)
|
| 188 |
+
|
| 189 |
+
# for finding Errors
|
| 190 |
for entry in entries:
|
| 191 |
|
| 192 |
# article
|
|
|
|
| 225 |
|
| 226 |
else:
|
| 227 |
print(f"{entry['ENTRYTYPE']} has to be added for processing.")
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
# For giving coordinates
|
| 231 |
+
for i in range(len(entries)):
|
| 232 |
+
entries[i]['pos']=data['refBibs'][i]['pos']
|
| 233 |
|
| 234 |
|
| 235 |
outputJson = json.dumps(entries)
|
|
|
|
| 242 |
gr.Markdown("# Reference Validation")
|
| 243 |
|
| 244 |
with gr.Row():
|
| 245 |
+
text_input1 = gr.TextArea()
|
| 246 |
+
|
| 247 |
+
with gr.Row():
|
| 248 |
+
text_input2 = gr.TextArea()
|
| 249 |
|
| 250 |
with gr.Row():
|
| 251 |
analyze_btn = gr.Button("Get Corrections")
|
|
|
|
| 258 |
|
| 259 |
analyze_btn.click(
|
| 260 |
fn=referenceErrorParser,
|
| 261 |
+
inputs=[text_input1, text_input2],
|
| 262 |
outputs=results_output
|
| 263 |
)
|
| 264 |
|