Spaces:
Build error
Build error
Exception if the input string is empty: FIXED
Browse files
app.py
CHANGED
@@ -120,6 +120,9 @@ def split_up_references(
|
|
120 |
|
121 |
def text_analysis(text, is_eol_mode):
|
122 |
|
|
|
|
|
|
|
123 |
html = ""
|
124 |
|
125 |
doc_with_linebreaks = split_up_references(
|
@@ -132,7 +135,7 @@ def text_analysis(text, is_eol_mode):
|
|
132 |
html += displacy.render(bib_item_doc, style="ent")
|
133 |
|
134 |
html = (
|
135 |
-
"<div style='max-width:100%; max-height:
|
136 |
+ html
|
137 |
+ "</div>"
|
138 |
)
|
@@ -145,13 +148,13 @@ with demo:
|
|
145 |
|
146 |
textbox = gr.components.Textbox(
|
147 |
label="Unparsed Bibliography Section",
|
148 |
-
placeholder="Enter bibliography here...",
|
149 |
lines=20,
|
150 |
)
|
151 |
is_eol_mode = gr.components.Checkbox(
|
152 |
-
label="
|
153 |
)
|
154 |
-
html = gr.components.HTML(label="Parsed
|
155 |
textbox.change(fn=text_analysis, inputs=[textbox, is_eol_mode], outputs=[html])
|
156 |
is_eol_mode.change(fn=text_analysis, inputs=[textbox, is_eol_mode], outputs=[html])
|
157 |
|
120 |
|
121 |
def text_analysis(text, is_eol_mode):
|
122 |
|
123 |
+
if not text:
|
124 |
+
return "<div style='max-width:100%; max-height:720px; overflow:auto; color:grey'><p>Unparsed Bibliography Section is empty</p></div>"
|
125 |
+
|
126 |
html = ""
|
127 |
|
128 |
doc_with_linebreaks = split_up_references(
|
135 |
html += displacy.render(bib_item_doc, style="ent")
|
136 |
|
137 |
html = (
|
138 |
+
"<div style='max-width:100%; max-height:720px; overflow:auto'>"
|
139 |
+ html
|
140 |
+ "</div>"
|
141 |
)
|
148 |
|
149 |
textbox = gr.components.Textbox(
|
150 |
label="Unparsed Bibliography Section",
|
151 |
+
placeholder="Enter bibliography here... It will be splitted up into separate references.",
|
152 |
lines=20,
|
153 |
)
|
154 |
is_eol_mode = gr.components.Checkbox(
|
155 |
+
label="My Unparsed Bibliography does not contain more than one reference per line (Multiline references are supported regardless of this choice)"
|
156 |
)
|
157 |
+
html = gr.components.HTML(label="Parsed Bibliography Section: list of references")
|
158 |
textbox.change(fn=text_analysis, inputs=[textbox, is_eol_mode], outputs=[html])
|
159 |
is_eol_mode.change(fn=text_analysis, inputs=[textbox, is_eol_mode], outputs=[html])
|
160 |
|