Replies: 1 comment
-
pip install pytesseract pillow googletrans==4.0.0-rc1 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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}")
Beta Was this translation helpful? Give feedback.
All reactions