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.5.0.tar.gz
(5.3 MB
view details)
Built Distribution
File details
Details for the file formless-0.5.0.tar.gz
.
File metadata
- Download URL: formless-0.5.0.tar.gz
- Upload date:
- Size: 5.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ed50fe50c089419abfa5cb7a93002c584f7fc596d52974c0fddcefccc24b65b |
|
MD5 | 438dd6f40d99b915196c97a75cc4e153 |
|
BLAKE2b-256 | 7fdbdebc414ad3f7292590e73e89b6b654dbde65311f2ba52c04dcbe3812718b |
File details
Details for the file formless-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: formless-0.5.0-py3-none-any.whl
- Upload date:
- Size: 4.5 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 | 98d920ce0166ab89114e75923173f3cc0375a145281d9f6a1b7e5345bbdd6791 |
|
MD5 | ec9199794f5d57a6d1e782046787ec83 |
|
BLAKE2b-256 | 708a5ac24e940ae2ccce4f6e8736d6b701e1d803e9b9c22b92fcf0cdbee8c708 |