summaryrefslogtreecommitdiffstats
path: root/Scripts/browser_src.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-10-05 18:22:55 -0700
committeryum <yum.food.vr@gmail.com>2023-10-05 18:28:42 -0700
commitadd7bd8ef86ec21cd1327eb45bcb739aa54f7db8 (patch)
treef342e37917c93073552854a125696e12afbd4c39 /Scripts/browser_src.py
parentc2bc70c18d2fd1c3601b32f2a93b3b4a704786a5 (diff)
Transcripts preceding long pauses now dropv0.16.0
When hot-miking into the built-in chatbox, there are sometimes long pauses in conversation. After these pauses, it's undesirable to show the transcript generate before the pause. This feature makes it so that those transcripts can be dropped. Also: * Limit number of segments sent to browser source to 10. Allow this to grow up to 10 segments before dropping the first 5 segments. * Silence warnings generated by `install_in_venv`, used by e.g. translation codepath. * Enable audio normalization to improve accuracy when speaking softly, at the cost of some accuracy when speaking normally. Credit: user endo0269 on Discord suggested this feature.
Diffstat (limited to 'Scripts/browser_src.py')
-rw-r--r--Scripts/browser_src.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Scripts/browser_src.py b/Scripts/browser_src.py
index befb2db..4ed3407 100644
--- a/Scripts/browser_src.py
+++ b/Scripts/browser_src.py
@@ -51,6 +51,10 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
self.http_server_instance = http_server_instance
super().__init__(*args, **kwargs)
+ def log_message(self, format, *args):
+ # TODO log if cfg["debug_mode_enabled"] is set
+ return
+
def do_GET(self):
self.handle_request('GET')
@@ -96,6 +100,12 @@ class BrowserSource(StreamingPlugin):
del commit.audio
if commit.delta:
self.commits.append(commit)
+ # Limit commits to last N.
+ now = time.time()
+ self.commits = [commit for commit in self.commits]
+ max_commits = 10
+ if len(self.commits) > max_commits:
+ self.commits = self.commits[-int(max_commits/2):]
self.preview_commit = commit
return original_commit