Handwritten + image OCR.
Project description
formless
Handwritten + image OCR.
Usage
Hit the API:
curl -X POST -H "Content-Type: application/json" -d '{"image_url": "<image-url>"}' https://andrewhinh--formless-api-model-infer.modal.run
Or use the CLI:
uv run formless -i <image-url> [-v]
Soon:
- Python bindings.
- Frontend.
Development
Set Up
Set up the environment:
uv sync --all-extras --dev
modal setup
Create a .env
(+ .env.dev
+ .env.local
):
API_URL=
HF_TOKEN=
LIVE=
DEBUG=
STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
DOMAIN=
WANDB_API_KEY=
WANDB_ENTITY=
Repository Structure
.
├── api # API.
├── frontend # frontend.
├── src/formless # python bindings.
├── training # training.
API
Test the API:
modal run api/app.py
Run the API "locally":
modal serve --env=dev api/app.py
Deploy on dev:
modal deploy --env=dev api/app.py
Deploy on main:
modal deploy --env=main api/app.py
Frontend
Run the web app "locally":
modal serve --env=dev frontend/app.py
stripe listen --forward-to <url>/webhook
# update API_URL, STRIPE_WEBHOOK_SECRET, and DOMAIN in .env.dev
Deploy on dev:
modal deploy --env=dev frontend/app.py
# update API_URL, STRIPE_WEBHOOK_SECRET, and DOMAIN in .env.dev
Deploy on main:
modal deploy --env=main frontend/app.py
PyPI
Run the package:
uv run formless -v
# update API_URL in src/formless/__init__.py
Build the package:
uvx --from build pyproject-build --installer uv
Upload the package:
uvx twine upload dist/*
Test the uploaded package:
uv run --with formless --no-project -- formless -v
Training (WIP)
Torchtune
Download the model:
uv run tune download meta-llama/Llama-3.2-11B-Vision-Instruct --output-dir /tmp/Llama-3.2-11B-Vision-Instruct
Run the training:
10:10 $ uv run tune run lora_finetune_single_device --config training/llama3_2_vision-11B_lora_single_device.yaml
Custom
Run ETL on HF dataset:
modal run ft/etl.py
Train the model:
modal run ft/train_modal.py
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
formless-0.6.0.tar.gz
(5.4 MB
view details)
Built Distribution
File details
Details for the file formless-0.6.0.tar.gz
.
File metadata
- Download URL: formless-0.6.0.tar.gz
- Upload date:
- Size: 5.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa84de5cbdd6a28b9bcf5457b74ddcf5f1b0e7ac66fb9d15692f199d5335dbb5 |
|
MD5 | 4d8c5c4433a4365c3955db3589f69482 |
|
BLAKE2b-256 | 26a28b58a4e44159c60c4991f96e0fff194e2b18cfa2f1dc4e854de08c5a2109 |
File details
Details for the file formless-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: formless-0.6.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13706bb85fbc5684e0431e3dbf1c103fae4f37ff9826613b9fea1f29cf36eec1 |
|
MD5 | d0e41b08c9bdecddf182fddf9d08a40f |
|
BLAKE2b-256 | 09564e1866ad3b768c939b4e1bc6c674b895226c925c0f970424e46a38291ec6 |