Contoh code sederhana untuk keras-ocr Download gambar di bawah ini, gunakan untuk diupload di colabs ![](https://i.imgur.com/YZmWUwF.jpg) Buka collabs dan edit code sebagai berikut : **Isi cell 1 :** try: %tensorflow_version 2.x except Exception: pass !pip install keras-ocr **Isi cell 2:** !mkdir uploads **Isi cell 3 :** from google.colab import files uploaded = files.upload() uploaded_files = list(uploaded.keys()) for uploaded_file in uploaded_files: print(uploaded_file) !mv \$uploaded_file uploads/\$uploaded_file **Isi cell 4 :** uploads_dir = "/content/uploads" custom_images = [] for filename in os.listdir(uploads_dir): print(os.path.join(uploads_dir, filename)) custom_images.append(os.path.join(uploads_dir, filename)) images = [ keras_ocr.tools.read(path) for path in custom_images] **Isi cell 5 :** import matplotlib.pyplot as plt import keras_ocr import os pipeline = keras_ocr.pipeline.Pipeline() image = keras_ocr.tools.read('/content/uploads/EUBanana-500x112.jpg') predictions = pipeline.recognize([image])[0] fig, ax = plt.subplots() drawn=keras_ocr.tools.drawAnnotations(image=image, predictions=predictions, ax=ax) plt.savefig('test.jpg') print('Predicted:', [text for text, box in predictions]) with open('results.txt', 'w+') as f: f.write(str([text for text, box in predictions])) Hasilnya : ![](https://i.imgur.com/lTUwLe4.png) https://colab.research.google.com/drive/1oQ5RcmLJkBDNdkXKvmDWcyhYvCgw310n?usp=sharing **code python lengkapnya :** import matplotlib.pyplot as plt import keras_ocr import os pipeline = keras_ocr.pipeline.Pipeline() image = keras_ocr.tools.read('/content/uploads/EUBanana-500x112.jpg') predictions = pipeline.recognize([image])[0] fig, ax = plt.subplots() drawn=keras_ocr.tools.drawAnnotations(image=image, predictions=predictions, ax=ax) plt.savefig('test.jpg') print('Predicted:', [text for text, box in predictions]) with open('results.txt', 'w+') as f: f.write(str([text for text, box in predictions]))