formless 0.1.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of formless might be problematic. Click here for more details.
- {formless-0.1.0 → formless-0.3.0}/PKG-INFO +25 -6
- {formless-0.1.0 → formless-0.3.0}/README.md +24 -5
- {formless-0.1.0 → formless-0.3.0}/api/app.py +2 -1
- {formless-0.1.0 → formless-0.3.0}/pyproject.toml +1 -1
- {formless-0.1.0 → formless-0.3.0}/src/formless/__init__.py +3 -7
- {formless-0.1.0 → formless-0.3.0}/uv.lock +1 -1
- {formless-0.1.0 → formless-0.3.0}/.github/workflows/pre-commit.yml +0 -0
- {formless-0.1.0 → formless-0.3.0}/.gitignore +0 -0
- {formless-0.1.0 → formless-0.3.0}/.pre-commit-config.yaml +0 -0
- {formless-0.1.0 → formless-0.3.0}/LICENSE +0 -0
- {formless-0.1.0 → formless-0.3.0}/frontend/app.py +0 -0
- {formless-0.1.0 → formless-0.3.0}/frontend/favicon.ico +0 -0
- {formless-0.1.0 → formless-0.3.0}/training/__init__.py +0 -0
- {formless-0.1.0 → formless-0.3.0}/training/etl.py +0 -0
- {formless-0.1.0 → formless-0.3.0}/training/inference.py +0 -0
- {formless-0.1.0 → formless-0.3.0}/training/train.py +0 -0
- {formless-0.1.0 → formless-0.3.0}/training/train_modal.py +0 -0
- {formless-0.1.0 → formless-0.3.0}/training/utils.py +0 -0
- {formless-0.1.0 → formless-0.3.0}/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: formless
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Handwritten + image OCR.
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.12
|
|
@@ -14,7 +14,28 @@ Description-Content-Type: text/markdown
|
|
|
14
14
|
|
|
15
15
|
Handwritten + image OCR.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Hit the API:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
curl -X POST -H "Content-Type: application/json" -d '{"image_url": "<image-url>"}' https://andrewhinh--formless-api-model-infer.modal.run
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or use the CLI:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv run formless -i <image-url> [-v]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Soon:
|
|
32
|
+
|
|
33
|
+
- Python bindings.
|
|
34
|
+
- Frontend.
|
|
35
|
+
|
|
36
|
+
## Development
|
|
37
|
+
|
|
38
|
+
### Set Up
|
|
18
39
|
|
|
19
40
|
Set up the environment:
|
|
20
41
|
|
|
@@ -24,7 +45,7 @@ uv run pre-commit install
|
|
|
24
45
|
modal setup
|
|
25
46
|
```
|
|
26
47
|
|
|
27
|
-
|
|
48
|
+
### Repository Structure
|
|
28
49
|
|
|
29
50
|
```bash
|
|
30
51
|
.
|
|
@@ -34,8 +55,6 @@ modal setup
|
|
|
34
55
|
├── training # training.
|
|
35
56
|
```
|
|
36
57
|
|
|
37
|
-
## Development
|
|
38
|
-
|
|
39
58
|
### API
|
|
40
59
|
|
|
41
60
|
Run the API:
|
|
@@ -87,7 +106,7 @@ uvx twine upload dist/*
|
|
|
87
106
|
Test the uploaded package:
|
|
88
107
|
|
|
89
108
|
```bash
|
|
90
|
-
uv run --with formless --no-project -- formless -
|
|
109
|
+
uv run --with formless --no-project -- formless -v
|
|
91
110
|
```
|
|
92
111
|
|
|
93
112
|
### Training
|
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Handwritten + image OCR.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Hit the API:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
curl -X POST -H "Content-Type: application/json" -d '{"image_url": "<image-url>"}' https://andrewhinh--formless-api-model-infer.modal.run
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or use the CLI:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv run formless -i <image-url> [-v]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Soon:
|
|
20
|
+
|
|
21
|
+
- Python bindings.
|
|
22
|
+
- Frontend.
|
|
23
|
+
|
|
24
|
+
## Development
|
|
25
|
+
|
|
26
|
+
### Set Up
|
|
6
27
|
|
|
7
28
|
Set up the environment:
|
|
8
29
|
|
|
@@ -12,7 +33,7 @@ uv run pre-commit install
|
|
|
12
33
|
modal setup
|
|
13
34
|
```
|
|
14
35
|
|
|
15
|
-
|
|
36
|
+
### Repository Structure
|
|
16
37
|
|
|
17
38
|
```bash
|
|
18
39
|
.
|
|
@@ -22,8 +43,6 @@ modal setup
|
|
|
22
43
|
├── training # training.
|
|
23
44
|
```
|
|
24
45
|
|
|
25
|
-
## Development
|
|
26
|
-
|
|
27
46
|
### API
|
|
28
47
|
|
|
29
48
|
Run the API:
|
|
@@ -75,7 +94,7 @@ uvx twine upload dist/*
|
|
|
75
94
|
Test the uploaded package:
|
|
76
95
|
|
|
77
96
|
```bash
|
|
78
|
-
uv run --with formless --no-project -- formless -
|
|
97
|
+
uv run --with formless --no-project -- formless -v
|
|
79
98
|
```
|
|
80
99
|
|
|
81
100
|
### Training
|
|
@@ -49,7 +49,7 @@ IMAGE = GPU_IMAGE.pip_install( # add Python dependencies
|
|
|
49
49
|
"vllm==0.6.2", "term-image==0.7.2"
|
|
50
50
|
)
|
|
51
51
|
API_TIMEOUT = 5 * MINUTES
|
|
52
|
-
API_CONTAINER_IDLE_TIMEOUT =
|
|
52
|
+
API_CONTAINER_IDLE_TIMEOUT = 1 * MINUTES # max
|
|
53
53
|
API_ALLOW_CONCURRENT_INPUTS = 1000 # max
|
|
54
54
|
|
|
55
55
|
GPU_TYPE = "H100"
|
|
@@ -135,6 +135,7 @@ class Model:
|
|
|
135
135
|
generated_text = outputs[0].outputs[0].text.strip()
|
|
136
136
|
|
|
137
137
|
# show the question, image, and response in the terminal for demonstration purposes
|
|
138
|
+
response = requests.get(image_url)
|
|
138
139
|
image_filename = image_url.split("/")[-1]
|
|
139
140
|
image_path = os.path.join(tempfile.gettempdir(), f"{uuid4()}-{image_filename}")
|
|
140
141
|
with open(image_path, "wb") as file:
|
|
@@ -3,8 +3,6 @@ import os
|
|
|
3
3
|
import tempfile
|
|
4
4
|
import time
|
|
5
5
|
from uuid import uuid4
|
|
6
|
-
from dotenv import load_dotenv
|
|
7
|
-
from pathlib import Path
|
|
8
6
|
from term_image.image import from_file
|
|
9
7
|
import requests
|
|
10
8
|
from rich import print
|
|
@@ -12,10 +10,9 @@ from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
|
12
10
|
import typer
|
|
13
11
|
from typing_extensions import Annotated
|
|
14
12
|
|
|
15
|
-
from utils import DEFAULT_IMG_URL
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
DEFAULT_IMG_URL = "https://modal-public-assets.s3.amazonaws.com/golden-gate-bridge.jpg"
|
|
15
|
+
API_URL = "https://andrewhinh--formless-api-model-infer.modal.run"
|
|
19
16
|
|
|
20
17
|
# Typer CLI
|
|
21
18
|
app = typer.Typer(
|
|
@@ -26,9 +23,8 @@ state = {"verbose": False}
|
|
|
26
23
|
|
|
27
24
|
# Fns
|
|
28
25
|
def run() -> None:
|
|
29
|
-
api_url = os.getenv("API_URL")
|
|
30
26
|
image_url = state["image_url"]
|
|
31
|
-
response = requests.post(
|
|
27
|
+
response = requests.post(API_URL, json={"image_url": image_url})
|
|
32
28
|
assert response.ok, response.status_code
|
|
33
29
|
return response.json()
|
|
34
30
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|