Action Table - Image

Build a Smart Receipt Scanner with JamAI Base

1. Introduction

This tutorial will guide you through using the JamAI Base SDK to create a simple receipt information extraction system.

What We'll Build

Snap a photo of your receipt and let AI do the expense report for you!

In this tutorial, we'll create a receipt processing system that:

  1. Takes a receipt image as input

  2. Uploads it to JamAI Base action table

  3. Extracts key information like:

    • Shop name

    • Total amount

Prerequisites

Before starting, you'll need:

  • Python 3.11 or higher installed

  • Project ID and Personal Access Token (PAT)

2. Installation and Setup

Installing the SDK

Basic Configuration

Get your Personal Access Token (PAT) here:

How to generate PAT

Get your Project ID here:

How to get Project ID

3. Creating Your Action Table

For simplicity, you can set up your action table in the JamAI Base platform:

  1. Navigate to your JamAI Base action table tab

  2. Create a new action table named "receipt"

  1. Configure the following columns:

Create new action table
Created table

4. Basic Implementation

4.1 Simple Receipt Processor

4.2 Complete Implementation with Error Handling

5. Usage Examples

5.1 Basic Usage

5.2 Batch Processing

6. Best Practices

  1. Error Handling

    • Always validate input files

    • Handle network errors gracefully

  2. Performance

    • Reuse the client instance

    • Consider batch processing for multiple files

    • Implement rate limiting for large batches

  3. Security

    • Use environment variables for credentials

Complete Standalone Example

Save this as receipt_processor.py:

How to Run

  1. Save the code above as receipt_processor.py

  2. Install required package:

  1. Run for a single receipt:

  1. Run for a folder of receipts:

Example Output

The receipt table with the uploaded image.

Features

  • Processes single images or entire folders

  • Validates file types and existence

  • Provides clear progress feedback

  • Formats results in an easy-to-read way

  • Includes error handling

  • Command-line argument support

This standalone example provides a complete, working implementation that you can use as a starting point for your own projects or modify according to your needs.

Last updated

Was this helpful?