Coder Social home page Coder Social logo

form-extractor-prototype's Introduction

Form Extractor Prototype

This tool extracts the structure from an image of a form.

It uses the Claude 3 LLM model by Anthropic.

A single extraction of an A4 form costs about 10p.

It replicates the form structue in JSON, following the schema used by GOV.UK Forms.

It then uses that to generate a multi-page web form in the GOV.UK style.

Run locally

You'll need an Anthropic API key.

Add the key as a local environment variable called ANTHROPIC_API_KEY.

Install the app locally with npm install.

Start the app with npm start.

It'll be available at http://localhost:3000/

Current limitations

  • it can only process images of forms, not documents
  • it only knows about certain kinds of question types
  • you can't provide your own API key via the UI
  • you can't browse previous form extractions
  • like a lot of Gen AI, it can be unpredictable

How it works

Disclaimer: This is a prototype and I am not a developer ;-).

The main UI is in app/views/index.html.

Additional CSS styles are in public/assets/style.css

The form in index.html is intercepted by the script in public/assets/scripts.js.

It sends the image at the URL provided by the user to the Claude API.

It does this via the 'SendToClaude' function in server.js.

The function makes use of the 'tools' feature of Claude.

That allows you to specify a JSON schema that you'd like it's response to conform to.

The results are saved as files in subfolders in app/views/results.

Those files are then loaded by scripts.js into iframes in app/views/index.html.

To do

  • switch from saving files to better use of routes
  • let users add an API key via the UI, so I can host the app somewhere
  • add more question types - eg. radio and checkbox lists

form-extractor-prototype's People

Contributors

timpaul avatar joelanman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.