Spaces:
Running
Running
from paddleocr import PaddleOCR | |
import translate_speak | |
def ocr_with_paddle(img): | |
""" | |
Paddle OCR | |
""" | |
try: | |
finaltext = '' | |
ocr = PaddleOCR(lang='en', use_angle_cls=True) | |
result = ocr.ocr(img) | |
for i in range(len(result[0])): | |
text = result[0][i][1][0] | |
finaltext += ' ' + text | |
audio_path = translate_speak.audio_streaming(txt=finaltext, to=1) | |
return finaltext, audio_path | |
except: | |
return "An err occurred upload image" | |
if __name__ == "__main__": | |
print(ocr_with_paddle('Images/download.jpeg')) |