From a51ea53b504c2c1f07f82e93cf66eee1f9e96115 Mon Sep 17 00:00:00 2001 From: Jelle Teijema Date: Tue, 14 Jan 2025 15:53:39 +0100 Subject: [PATCH] Update README.md with new local endpoint usage example The old method will result in a deprecation warning, this is the recommended method via openAI. ```python @deprecated( "Due to a bug, this method doesn't actually stream the response content, `.with_streaming_response.method()` should be used instead" ) def stream_to_file( ... ``` --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1f9d637..d0cf1f0 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,14 @@ The service can be accessed through either the API endpoints or the Gradio web i api_key="not-needed" ) - response = client.audio.speech.create( + with client.audio.speech.with_streaming_response.create( model="kokoro", voice="af_sky+af_bella", #single or multiple voicepack combo input="Hello world!", response_format="mp3" - ) - response.stream_to_file("output.mp3") + ) as response: + response.stream_to_file("output.mp3") + ``` or visit http://localhost:7860