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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: formless
3
- Version: 0.1.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
- ## Set Up
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
- ## Repository Structure
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 -vv
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
- ## Set Up
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
- ## Repository Structure
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 -vv
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 = 20 * MINUTES # max
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:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "formless"
3
- version = "0.1.0"
3
+ version = "0.3.0"
4
4
  description = "Handwritten + image OCR."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -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
- parent_path = Path(__file__).parent.parent.parent
18
- load_dotenv(parent_path / ".env")
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(api_url, json={"image_url": image_url})
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
 
@@ -200,7 +200,7 @@ wheels = [
200
200
 
201
201
  [[package]]
202
202
  name = "formless"
203
- version = "0.1.0"
203
+ version = "0.3.0"
204
204
  source = { editable = "." }
205
205
  dependencies = [
206
206
  { name = "modal" },
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