Upload folder using huggingface_hub
Browse files
chat.py
CHANGED
|
@@ -97,7 +97,7 @@ def main():
|
|
| 97 |
speech.click(None, js=toggle_js)
|
| 98 |
msg = gr.Textbox(label="Say something.", elem_id="textbox")
|
| 99 |
mic = gr.Microphone(type="filepath", format="mp3", editable=False, waveform_options={"show_controls": False}, visible=False, elem_id="recorder")
|
| 100 |
-
player = gr.Audio(editable=False,elem_id="player")
|
| 101 |
msg.submit(user, [msg, mic, chatbot, thread], [msg, chatbot]).then(
|
| 102 |
bot, [chatbot, thread], chatbot).then(
|
| 103 |
speak, chatbot, player
|
|
|
|
| 97 |
speech.click(None, js=toggle_js)
|
| 98 |
msg = gr.Textbox(label="Say something.", elem_id="textbox")
|
| 99 |
mic = gr.Microphone(type="filepath", format="mp3", editable=False, waveform_options={"show_controls": False}, visible=False, elem_id="recorder")
|
| 100 |
+
player = gr.Audio(editable=False,elem_id="player", visible=False)
|
| 101 |
msg.submit(user, [msg, mic, chatbot, thread], [msg, chatbot]).then(
|
| 102 |
bot, [chatbot, thread], chatbot).then(
|
| 103 |
speak, chatbot, player
|
play.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
| 1 |
function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
}
|
|
|
|
| 1 |
function () {
|
| 2 |
+
|
| 3 |
+
function waitForElementToAppear(selector, callback) {
|
| 4 |
+
const targetNode = document.body;
|
| 5 |
+
const config = { childList: true, subtree: true };
|
| 6 |
|
| 7 |
+
const observer = new MutationObserver((mutationsList, observer) => {
|
| 8 |
+
const element = document.querySelector(selector);
|
| 9 |
+
if (element) {
|
| 10 |
+
observer.disconnect();
|
| 11 |
+
callback(element);
|
| 12 |
+
}
|
| 13 |
+
});
|
| 14 |
+
|
| 15 |
+
observer.observe(targetNode, config);
|
| 16 |
}
|
| 17 |
+
|
| 18 |
+
waitForElementToAppear("#player button.play-pause-button", (button) => {
|
| 19 |
+
button.click();
|
| 20 |
+
});
|
| 21 |
+
|
| 22 |
}
|