mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-04 17:39:23 +08:00
add note on asynch (#103)
Co-authored-by: Freddy Boulton <freddyboulton@hf-freddy.local>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
## Reply On Pause
|
||||
|
||||
Typically, you want to run a python function whenever a user has stopped speaking. This can be done by wrapping a python generator with the `ReplyOnPause` class and passing it to the `handler` argument of the `Stream` object.
|
||||
Typically, you want to run a python function whenever a user has stopped speaking. This can be done by wrapping a python generator with the `ReplyOnPause` class and passing it to the `handler` argument of the `Stream` object. The `ReplyOnPause` class will handle the voice detection and turn taking logic automatically!
|
||||
|
||||
=== "Code"
|
||||
```python
|
||||
@@ -29,12 +29,8 @@ Typically, you want to run a python function whenever a user has stopped speakin
|
||||
|
||||
2. The generator must yield audio chunks as a tuple of (sampling_rate, numpy audio array). Each numpy audio array must have a shape of (1, num_samples).
|
||||
|
||||
|
||||
The `ReplyOnPause` class will handle the voice detection and turn taking logic automatically!
|
||||
|
||||
!!! warning "Argument Order"
|
||||
|
||||
The first argument to the function must be the audio
|
||||
!!! tip "Asynchronous"
|
||||
You can also use an async generator with `ReplyOnPause`.
|
||||
|
||||
!!! tip "Parameters"
|
||||
You can customize the voice detection parameters by passing in `algo_options` and `model_options` to the `ReplyOnPause` class.
|
||||
|
||||
Reference in New Issue
Block a user