Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,7 +71,13 @@ def process_input(image=None, file=None, audio=None, text=""):
|
|
| 71 |
ocr_processor = OCRProcessor()
|
| 72 |
final_text = text
|
| 73 |
if image is not None:
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
if file is not None:
|
| 76 |
if file.name.lower().endswith(('.png', '.jpg', '.jpeg')):
|
| 77 |
pil_image = Image.open(file)
|
|
|
|
| 71 |
ocr_processor = OCRProcessor()
|
| 72 |
final_text = text
|
| 73 |
if image is not None:
|
| 74 |
+
ocr_prediction = ocr_processor.process_image(image)
|
| 75 |
+
# gettig text from ocr object
|
| 76 |
+
for idx in range(len((list(ocr_prediction[0])[0][1]))):
|
| 77 |
+
final_text += " "
|
| 78 |
+
final_text += list((list(ocr_prediction[0])[0][1])[idx])[1][1]
|
| 79 |
+
# final_text += "\n" + ocr_processor.process_image(image)
|
| 80 |
+
print(final_text)
|
| 81 |
if file is not None:
|
| 82 |
if file.name.lower().endswith(('.png', '.jpg', '.jpeg')):
|
| 83 |
pil_image = Image.open(file)
|