Spaces:
Running
on
Zero
Running
on
Zero
Helw150
commited on
Commit
•
3583d5c
1
Parent(s):
c8a9127
Make UX Better for people who have disabled autoplay
Browse files
app.py
CHANGED
@@ -183,7 +183,8 @@ async function main() {
|
|
183 |
const myvad = await vad.MicVAD.new({
|
184 |
onSpeechStart: () => {
|
185 |
var record = document.querySelector('.record-button');
|
186 |
-
|
|
|
187 |
console.log(record);
|
188 |
record.click();
|
189 |
}
|
@@ -242,7 +243,7 @@ with gr.Blocks(theme=theme, js=js) as demo:
|
|
242 |
respond = input_audio.stop_recording(
|
243 |
response, [state, input_audio], [state, chatbot, output_audio]
|
244 |
)
|
245 |
-
restart =
|
246 |
lambda state: state, state, state, js=js_reset
|
247 |
)
|
248 |
|
|
|
183 |
const myvad = await vad.MicVAD.new({
|
184 |
onSpeechStart: () => {
|
185 |
var record = document.querySelector('.record-button');
|
186 |
+
var player = document.querySelector('#streaming-out')
|
187 |
+
if (record != null && (player == null || player.paused)) {
|
188 |
console.log(record);
|
189 |
record.click();
|
190 |
}
|
|
|
243 |
respond = input_audio.stop_recording(
|
244 |
response, [state, input_audio], [state, chatbot, output_audio]
|
245 |
)
|
246 |
+
restart = respond.then(start_recording_user, [state], [input_audio]).then(
|
247 |
lambda state: state, state, state, js=js_reset
|
248 |
)
|
249 |
|