Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,25 @@ head = '''
|
|
45 |
window.replaceSpecialChars = replaceSpecialChars
|
46 |
</script>
|
47 |
'''
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
gr.Markdown("## LLM is unstable:The inference client used in this demo exhibits inconsistent performance. While it can provide responses in milliseconds, it sometimes becomes unresponsive and times out.")
|
50 |
gr.Markdown("## TTS talke a long loading time:Please be patient, the first response may have a delay of up to over 20 seconds while loading.")
|
51 |
gr.Markdown("**gemma-2-27b-it/LJSpeech**.LLM and TTS models will change without notice.")
|
|
|
45 |
window.replaceSpecialChars = replaceSpecialChars
|
46 |
</script>
|
47 |
'''
|
48 |
+
scroll_js="""
|
49 |
+
function Scrolldown() {
|
50 |
+
let targetNode = document.querySelector('[aria-label="chatbot conversation"]'>
|
51 |
+
// Options for the observer (which mutations to observe)
|
52 |
+
const config = { attributes: true, childList: true, subtree: true };
|
53 |
+
|
54 |
+
// Callback function to execute when mutations are observed
|
55 |
+
const callback = (mutationList, observer) => {
|
56 |
+
targetNode.scrollTop = targetNode.scrollHeight;
|
57 |
+
};
|
58 |
+
|
59 |
+
// Create an observer instance linked to the callback function
|
60 |
+
const observer = new MutationObserver(callback);
|
61 |
+
|
62 |
+
// Start observing the target node for configured mutations
|
63 |
+
observer.observe(targetNode, config);
|
64 |
+
}
|
65 |
+
"""
|
66 |
+
with gr.Blocks(title="LLM with TTS",head=head,js = scroll_js) as demo:
|
67 |
gr.Markdown("## LLM is unstable:The inference client used in this demo exhibits inconsistent performance. While it can provide responses in milliseconds, it sometimes becomes unresponsive and times out.")
|
68 |
gr.Markdown("## TTS talke a long loading time:Please be patient, the first response may have a delay of up to over 20 seconds while loading.")
|
69 |
gr.Markdown("**gemma-2-27b-it/LJSpeech**.LLM and TTS models will change without notice.")
|