forked from xorbitsai/inference
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOC: Add doc for ocr (xorbitsai#2492)
Co-authored-by: qinxuye <[email protected]>
- Loading branch information
1 parent
9a5aeb0
commit bd599b2
Showing
5 changed files
with
83 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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,19 @@ | ||
.. _models_builtin_got-ocr2_0: | ||
|
||
========== | ||
GOT-OCR2_0 | ||
========== | ||
|
||
- **Model Name:** GOT-OCR2_0 | ||
- **Model Family:** ocr | ||
- **Abilities:** ocr | ||
- **Available ControlNet:** None | ||
|
||
Specifications | ||
^^^^^^^^^^^^^^ | ||
|
||
- **Model ID:** stepfun-ai/GOT-OCR2_0 | ||
|
||
Execute the following command to launch the model:: | ||
|
||
xinference launch --model-name GOT-OCR2_0 --model-type image |
This file contains 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 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 |
---|---|---|
|
@@ -156,3 +156,34 @@ You can find more examples of Images API in the tutorial notebook: | |
|
||
Learn from a Stable Diffusion ControlNet example | ||
|
||
OCR | ||
-------------------- | ||
|
||
The OCR API accepts image bytes and returns the OCR text. | ||
|
||
We can try OCR API out either via cURL, or Xinference's python client: | ||
|
||
.. tabs:: | ||
|
||
.. code-tab:: bash cURL | ||
|
||
curl -X 'POST' \ | ||
'http://<XINFERENCE_HOST>:<XINFERENCE_PORT>/v1/images/ocr' \ | ||
-F model=<MODEL_UID> \ | ||
-F [email protected] | ||
|
||
|
||
.. code-tab:: python Xinference Python Client | ||
|
||
from xinference.client import Client | ||
|
||
client = Client("http://<XINFERENCE_HOST>:<XINFERENCE_PORT>") | ||
|
||
model = client.get_model("<MODEL_UID>") | ||
with open("xxx.jpg", "rb") as f: | ||
model.ocr(f.read()) | ||
|
||
|
||
.. code-tab:: text output | ||
|
||
<OCR result string> |
This file contains 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