-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
docs: add instructions for using clip server hosted by jina #848
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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 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,95 @@ | ||
# Hosted by Jina AI | ||
|
||
Just like any other machine learning models, CLIP models have better performance when running on GPU. However, it is not always possible to have a GPU machine at hand, and it could be costly to configure a GPU machine. To make CLIP models more accessible, we provide a hosted service for CLIP models. You can send requests to our hosted service and get the embedding results back. | ||
|
||
An always-online server `api.clip.jina.ai` loaded with `ViT-L-14-336::openai` is there for you to play or develop your CLIP applications. The server is available for **encoding** and **ranking** tasks. | ||
|
||
Before you start, make sure you have obtained an access token from our [console website](https://console.clip.jina.ai/get_started), or via CLI as described in [this guide](https://docs.jina.ai/jina-ai-cloud/login/#create-a-new-pat) | ||
|
||
```bash | ||
jina auth token create <name of PAT> -e <expiration days> | ||
``` | ||
|
||
(by-jina-python)= | ||
## Connect in Python | ||
|
||
We provide two ways to send requests to our hosted service: via gRPCs and via HTTPs. | ||
|
||
| Protocol | Address | | ||
| -------- | ------------------------------- | | ||
| gRPCs | `grpcs://api.clip.jina.ai:2096` | | ||
| HTTPs | `https://api.clip.jina.ai:8443` | | ||
|
||
|
||
To use the service, you need select the protocol by specifying corresponding address in the client. For example, if you want to use gRPCs, you need to specify the address as `grpcs://api.clip.jina.ai:2096`. | ||
|
||
Then, you need to configure the access token in the parameter `credential` of the client: | ||
|
||
|
||
````{tab} via gRPCs | ||
|
||
```{code-block} python | ||
--- | ||
emphasize-lines: 4 | ||
--- | ||
from clip_client import Client | ||
|
||
c = Client( | ||
'grpcs://api.clip.jina.ai:2096', credential={'Authorization': '<your access token>'} | ||
) | ||
|
||
r = c.encode( | ||
[ | ||
'First do it', | ||
'then do it right', | ||
'then do it better', | ||
'https://picsum.photos/200', | ||
] | ||
) | ||
``` | ||
|
||
```` | ||
````{tab} via HTTPs | ||
|
||
```{code-block} python | ||
--- | ||
emphasize-lines: 4 | ||
--- | ||
from clip_client import Client | ||
|
||
c = Client( | ||
'https://api.clip.jina.ai:8443', credential={'Authorization': '<your access token>'} | ||
) | ||
|
||
r = c.encode( | ||
[ | ||
'First do it', | ||
'then do it right', | ||
'then do it better', | ||
'https://picsum.photos/200', | ||
] | ||
) | ||
``` | ||
|
||
```` | ||
|
||
(by-jina-curl)= | ||
## Connect using plain HTTP request via `curl` | ||
|
||
You can also send requests to our hosted service using plain HTTP request via `curl` by configuring the access token in the HTTP request header `Authorization` as `<your access token>`. | ||
|
||
|
||
```{code-block} bash | ||
--- | ||
emphasize-lines: 4 | ||
--- | ||
curl \ | ||
-X POST https://api.clip.jina.ai:8443/post \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Authorization: <your access token>' \ | ||
-d '{"data":[{"text": "First do it"}, | ||
{"text": "then do it right"}, | ||
{"text": "then do it better"}, | ||
{"uri": "https://picsum.photos/200"}], | ||
"execEndpoint":"/"}' | ||
``` |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference betwee hostted by Jina AI and hosted by jCloud? I think this title is misleading. Maybe we can just use # Cloud Hosting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this page would explain the SaaS product.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One is hosted by Jina, right now the user can only access it but not control it.
The other is hosted on Jcloud, the user has full control of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this title does not tell the difference