-
Notifications
You must be signed in to change notification settings - Fork 2
✨ add support for V2 products #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+3,055
−253
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
121746b
temp
sebastianMindee 289270e
implement v2 base (no tests) - steep & rubocop OK
sebastianMindee 8322a71
fix test
sebastianMindee 5a77968
add crop (no tests)
sebastianMindee 3e3144c
add (unit) test
sebastianMindee 798d30c
add integration test
sebastianMindee 1b1f845
fix lint
sebastianMindee 8ca1749
:sparkles: add support for classification
sebastianMindee 331daae
:sparkles: add support for OCR
sebastianMindee 48974e0
:sparkles: add support for split
sebastianMindee 8452af4
fix imports?
sebastianMindee 0f23653
fix api calls
sebastianMindee 2a42b4f
fix typos
sebastianMindee f7ece5f
fix job polling & accessing
sebastianMindee ab29344
add code samples + fix url access
sebastianMindee afdcace
fix code samples + add env vars
sebastianMindee 85f97a3
fix code samples
sebastianMindee 12cb61a
restore whoopsie
sebastianMindee 6ef6adc
remove polling through URL
sebastianMindee fd950f0
update system to only include one class
sebastianMindee 3d35c1c
fixes
sebastianMindee 8b5abd0
apply fixes
sebastianMindee 7acd933
fix code samples
sebastianMindee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ jobs: | |
| - "3.2" | ||
| - "3.3" | ||
| - "3.4" | ||
| - "4.0" | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ | |
| /test/version_tmp/ | ||
| /tmp/ | ||
| _test.rb | ||
| _test_v1.rb | ||
| _test_v2.rb | ||
| /vendor | ||
| /mindee-*/ | ||
| local-test | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ AllCops: | |
| - 'tmp/**/*' | ||
| - '.git/**/*' | ||
| - 'bin/*' | ||
| - _test.rb | ||
| - _test*.rb | ||
| - local_test/* | ||
| - Steepfile | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'mindee' | ||
| require 'mindee/v2/product' | ||
|
|
||
| input_path = '/path/to/the/file.ext' | ||
| api_key = 'MY_API_KEY' | ||
| model_id = 'MY_MODEL_ID' | ||
|
|
||
| # Init a new client | ||
| mindee_client = Mindee::ClientV2.new(api_key: api_key) | ||
|
|
||
| # Set inference parameters | ||
| classification_params = { | ||
| # ID of the model, required. | ||
| model_id: model_id, | ||
| } | ||
|
|
||
| # Load a file from disk | ||
| input_source = Mindee::Input::Source::PathInputSource.new(input_path) | ||
|
|
||
| # Send for processing | ||
| response = mindee_client.enqueue_and_get_result( | ||
| Mindee::V2::Product::Classification::Classification, | ||
| input_source, | ||
| classification_params | ||
| ) | ||
|
|
||
| # Access the classification result | ||
| puts response.inference.result.classification |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'mindee' | ||
| require 'mindee/v2/product' | ||
|
|
||
| input_path = '/path/to/the/file.ext' | ||
| api_key = 'MY_API_KEY' | ||
| model_id = 'MY_MODEL_ID' | ||
|
|
||
| # Init a new client | ||
| mindee_client = Mindee::ClientV2.new(api_key: api_key) | ||
|
|
||
| # Set inference parameters | ||
| crop_params = { | ||
| # ID of the model, required. | ||
| model_id: model_id, | ||
| } | ||
|
|
||
| # Load a file from disk | ||
| input_source = Mindee::Input::Source::PathInputSource.new(input_path) | ||
|
|
||
| # Send for processing | ||
| response = mindee_client.enqueue_and_get_result( | ||
| Mindee::V2::Product::Crop::Crop, | ||
| input_source, | ||
| crop_params | ||
| ) | ||
|
|
||
| # Access the result crops | ||
| puts response.inference.result.crops |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sebastianMindee marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'mindee' | ||
| require 'mindee/v2/product' | ||
|
|
||
| input_path = '/path/to/the/file.ext' | ||
| api_key = 'MY_API_KEY' | ||
| model_id = 'MY_MODEL_ID' | ||
|
|
||
| # Init a new client | ||
| mindee_client = Mindee::ClientV2.new(api_key: api_key) | ||
|
|
||
| inference_params = { | ||
| # ID of the model, required. | ||
| model_id: model_id, | ||
| # Add any number of webhook IDs here. | ||
| webhook_ids: ['MY_WEBHOOK_ID'], | ||
|
|
||
| # Options: set to `true` or `false` to override defaults | ||
|
|
||
| # Enhance extraction accuracy with Retrieval-Augmented Generation. | ||
| rag: nil, | ||
| # Extract the full text content from the document as strings. | ||
| raw_text: nil, | ||
| # Calculate bounding box polygons for all fields. | ||
| polygon: nil, | ||
| # Boost the precision and accuracy of all extractions. | ||
| # Calculate confidence scores for all fields. | ||
| confidence: nil | ||
| } | ||
|
|
||
| # Load a file from disk | ||
| input_source = Mindee::Input::Source::PathInputSource.new(input_path) | ||
|
|
||
| # Send for processing | ||
| response = mindee_client.enqueue( | ||
| Mindee::V2::Product::Extraction::Extraction, | ||
| input_source, | ||
| inference_params | ||
| ) | ||
|
|
||
| # Print the job ID | ||
| job_id = response.job.id | ||
|
|
||
| puts job_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'mindee' | ||
| require 'mindee/v2/product' | ||
|
|
||
| input_path = '/path/to/the/file.ext' | ||
| api_key = 'MY_API_KEY' | ||
| model_id = 'MY_MODEL_ID' | ||
|
|
||
| # Init a new client | ||
| mindee_client = Mindee::ClientV2.new(api_key: api_key) | ||
|
|
||
| # Set inference parameters | ||
| ocr_params = { | ||
| # ID of the model, required. | ||
| model_id: model_id, | ||
| } | ||
|
|
||
| # Load a file from disk | ||
| input_source = Mindee::Input::Source::PathInputSource.new(input_path) | ||
|
|
||
| # Send for processing | ||
| response = mindee_client.enqueue_and_get_result( | ||
| Mindee::V2::Product::Ocr::Ocr, | ||
| input_source, | ||
| ocr_params | ||
| ) | ||
|
|
||
| # Access the result OCR pages | ||
| puts response.inference.result.pages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'mindee' | ||
| require 'mindee/v2/product' | ||
|
|
||
| input_path = '/path/to/the/file.ext' | ||
| api_key = 'MY_API_KEY' | ||
| model_id = 'MY_MODEL_ID' | ||
|
|
||
| # Init a new client | ||
| mindee_client = Mindee::ClientV2.new(api_key: api_key) | ||
|
|
||
| # Set inference parameters | ||
| split_params = { | ||
| # ID of the model, required. | ||
| model_id: model_id, | ||
| } | ||
|
|
||
| # Load a file from disk | ||
| input_source = Mindee::Input::Source::PathInputSource.new(input_path) | ||
|
|
||
| # Send for processing | ||
| response = mindee_client.enqueue_and_get_result( | ||
| Mindee::V2::Product::Split::Split, | ||
| input_source, | ||
| split_params | ||
| ) | ||
|
|
||
| # Access the result splits | ||
| puts response.inference.result.splits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.