-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add language support to translation client, solves #1763 * Update tests/test_inference_client.py Co-authored-by: Lucain <lucainp@gmail.com> * Update tests/test_inference_client.py Co-authored-by: Lucain <lucainp@gmail.com> * Update src/huggingface_hub/inference/_client.py Co-authored-by: Lucain <lucainp@gmail.com> * update the async client to match * add cassette for translation tests * Update src/huggingface_hub/inference/_client.py * Apply suggestions from code review * Update src/huggingface_hub/inference/_generated/_async_client.py --------- Co-authored-by: Lucain <lucainp@gmail.com>
- Loading branch information
1 parent
8aec94b
commit 32b8d56
Showing
4 changed files
with
129 additions
and
6 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
55 changes: 55 additions & 0 deletions
55
tests/cassettes/InferenceClientVCRTest.test_translation_with_source_and_target_language.yaml
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,55 @@ | ||
interactions: | ||
- request: | ||
body: '{"inputs": "Hello world", "parameters": {"src_lang": "en_XX", "tgt_lang": | ||
"fr_XX"}}' | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '83' | ||
Content-Type: | ||
- application/json | ||
X-Amzn-Trace-Id: | ||
- 6cb959e3-b061-4949-8b49-5ed5069382ed | ||
user-agent: | ||
- unknown/None; hf_hub/0.20.0.dev0; python/3.10.12 | ||
method: POST | ||
uri: https://api-inference.huggingface.co/models/facebook/mbart-large-50-many-to-many-mmt | ||
response: | ||
body: | ||
string: '[{"translation_text":"Hello world"}]' | ||
headers: | ||
Connection: | ||
- keep-alive | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Tue, 28 Nov 2023 12:23:24 GMT | ||
Transfer-Encoding: | ||
- chunked | ||
access-control-allow-credentials: | ||
- 'true' | ||
access-control-expose-headers: | ||
- x-compute-type, x-compute-time | ||
server: | ||
- uvicorn | ||
vary: | ||
- Origin, Access-Control-Request-Method, Access-Control-Request-Headers | ||
x-compute-characters: | ||
- '11' | ||
x-compute-time: | ||
- '0.739' | ||
x-compute-type: | ||
- cpu | ||
x-request-id: | ||
- 7qdna_s8iNTqOlR4PvwI- | ||
x-sha: | ||
- e30b6cb8eb0d43a0b73cab73c7676b9863223a30 | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
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