Note:

Build Llama Optical Character Recognition Web Application using OCI Generative AI

Introduction

If you are a developer, cloud architect, or AI enthusiast who liked Llama Optical Character Recognition (OCR), this tutorial is for you. In this tutorial, you will build a simple, Llama OCR web application that:

Objectives

We will build a web user interface (UI) that allows you to:

Prerequisites

Task 1: Download Python Code and Set up Config File

  1. Download the code from here: llama-ocr-oci.py

  2. Make sure you have the correct config profile configured in the file ~/.oci/config with a name for it. For example, OCI_PROFILE.

Task 2: Set up a Virtual Environment

Creating a virtual environment helps isolate dependencies and ensures your Streamlit OCR app does not interfere with other Python projects on your system.

Task 3: Launch the Application

Run the following command to launch the application.

streamlit run ocr_vision_app.py

You should see the application launch in your browser.

app

Task 4: Upload an Image and Extract the Text

  1. In Select OCI Config Profile, select your config profile from the drop-down menu.

  2. In Enter Compartment OCID, enter the compartment Oracle Cloud Identifier (OCID) where you have the access to the OCI Generative AI service.

  3. In Select Vision Model, select a model.

  4. Click Upload and select an image (receipt, invoice, screenshot).

    The application will process the image and display the extracted text.

    parsing

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.