Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ class Chatbot():
|
|
67 |
# y_diff and font_size_diff are used to separate paragraphs into different elements in the paper_text list by
|
68 |
# checking the y coordinate and the font size of the current text element and comparing it to the previous text element
|
69 |
for idx, t in enumerate(page_text):
|
70 |
-
if prev_y is None:
|
71 |
y_diff = abs(t['y'] - prev_y)
|
72 |
font_size_diff = abs(t['fontsize'] - prev_font_size)
|
73 |
|
@@ -82,7 +82,9 @@ class Chatbot():
|
|
82 |
'page': i
|
83 |
})
|
84 |
paragraph = ''
|
85 |
-
|
|
|
|
|
86 |
# Add text to paragraph, and update the variables.
|
87 |
paragraph += f" {t['text']}"
|
88 |
prev_y = t['y']
|
|
|
67 |
# y_diff and font_size_diff are used to separate paragraphs into different elements in the paper_text list by
|
68 |
# checking the y coordinate and the font size of the current text element and comparing it to the previous text element
|
69 |
for idx, t in enumerate(page_text):
|
70 |
+
if prev_y is not None and prev_font_size is not None:
|
71 |
y_diff = abs(t['y'] - prev_y)
|
72 |
font_size_diff = abs(t['fontsize'] - prev_font_size)
|
73 |
|
|
|
82 |
'page': i
|
83 |
})
|
84 |
paragraph = ''
|
85 |
+
else:
|
86 |
+
y_diff = 0
|
87 |
+
font_size_diff = 0
|
88 |
# Add text to paragraph, and update the variables.
|
89 |
paragraph += f" {t['text']}"
|
90 |
prev_y = t['y']
|