Replies: 1 comment
|
pip install pytesseract pillow googletrans==4.0.0-rc1 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Can you do local translation and fix text using pytesseract and google transltor api ?
below one is working for extract and translate.
import pytesseract
from PIL import Image
from googletrans import Translator
Path to Tesseract-OCR (modify if needed)
pytesseract.pytesseract.tesseract_cmd = r'C:\Trans\Tesseract-OCR\tesseract.exe'
Load image and extract text
image_path = input("Enter image path: ")
image = Image.open(image_path)
extracted_text = pytesseract.image_to_string(image)
Translate the extracted text
translator = Translator()
translated_text = translator.translate(extracted_text, dest='en').text
print(f"Extracted Text: {extracted_text}")
print(f"Translated Text: {translated_text}")
All reactions