Spaces:
Runtime error
Runtime error
sberbank-ai
commited on
Commit
•
5fae110
1
Parent(s):
67f47a5
chore: Replace loop to list compreh
Browse files
app.py
CHANGED
@@ -41,11 +41,9 @@ def predict(image_path):
|
|
41 |
rotated_image, pred_data = PREDICTOR(image)
|
42 |
structured_text = get_structured_text(pred_data, ['shrinked_text'])
|
43 |
|
44 |
-
result_text = ''
|
45 |
-
|
46 |
-
|
47 |
-
result_text += ' '.join(line_text) + '\n'
|
48 |
-
return result_text
|
49 |
|
50 |
|
51 |
PIPELINE_CONFIG_PATH = get_config_and_download_weights("sberbank-ai/ReadingPipeline-Peter")
|
|
|
41 |
rotated_image, pred_data = PREDICTOR(image)
|
42 |
structured_text = get_structured_text(pred_data, ['shrinked_text'])
|
43 |
|
44 |
+
result_text = [' '.join(line_text) for page_text in structured_text
|
45 |
+
for line_text in page_text]
|
46 |
+
return '\n'.join(result_text)
|
|
|
|
|
47 |
|
48 |
|
49 |
PIPELINE_CONFIG_PATH = get_config_and_download_weights("sberbank-ai/ReadingPipeline-Peter")
|