Anurag
commited on
Commit
Β·
30ab92a
1
Parent(s):
5306da4
fixed minor chat bug
Browse files- __pycache__/kokoro.cpython-310.pyc +0 -0
- chat_history.pkl +2 -2
- whiper-live.py +0 -91
__pycache__/kokoro.cpython-310.pyc
CHANGED
Binary files a/__pycache__/kokoro.cpython-310.pyc and b/__pycache__/kokoro.cpython-310.pyc differ
|
|
chat_history.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:926248e52d1fa532c317e37da24ed652ae64110f8219cb5e061668bd3091f048
|
3 |
+
size 5
|
whiper-live.py
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
import numpy as np
|
2 |
-
import pyaudio
|
3 |
-
from collections import deque
|
4 |
-
|
5 |
-
class WhisperLiveTerminalTest:
|
6 |
-
def __init__(self):
|
7 |
-
# Audio settings
|
8 |
-
self.sample_rate = 16000
|
9 |
-
self.chunk_size = 1024
|
10 |
-
self.channels = 1
|
11 |
-
self.format = pyaudio.paInt16
|
12 |
-
|
13 |
-
# Whisper-Live client
|
14 |
-
self.client = None
|
15 |
-
self.server_url = "localhost"
|
16 |
-
self.server_port = 9090
|
17 |
-
|
18 |
-
# Recording state
|
19 |
-
self.is_recording = False
|
20 |
-
self.audio_buffer = deque()
|
21 |
-
|
22 |
-
print("Whisper-Live Terminal Test Initialized")
|
23 |
-
|
24 |
-
def setup_client(self):
|
25 |
-
"""Setup Whisper-Live client with correct API parameters"""
|
26 |
-
try:
|
27 |
-
from whisper_live.client import TranscriptionClient
|
28 |
-
|
29 |
-
# Try the newer API first (v0.0.7+)
|
30 |
-
try:
|
31 |
-
self.client = TranscriptionClient(
|
32 |
-
self.server_url,
|
33 |
-
self.server_port,
|
34 |
-
lang="en", # Updated parameter name
|
35 |
-
translate=False,
|
36 |
-
model="base"
|
37 |
-
)
|
38 |
-
print("β
Connected with newer API (v0.0.7+)")
|
39 |
-
return True
|
40 |
-
except TypeError:
|
41 |
-
# Fallback to older API (v0.0.4)
|
42 |
-
self.client = TranscriptionClient(
|
43 |
-
self.server_url,
|
44 |
-
self.server_port,
|
45 |
-
multilingual=False, # Older parameter name
|
46 |
-
language="en",
|
47 |
-
translate=False
|
48 |
-
)
|
49 |
-
print("β
Connected with older API (v0.0.4)")
|
50 |
-
return True
|
51 |
-
|
52 |
-
except Exception as e:
|
53 |
-
print(f"β Failed to setup client: {e}")
|
54 |
-
print("π‘ Make sure Whisper-Live server is running:")
|
55 |
-
print(" python -c \"from whisper_live.server import TranscriptionServer; server = TranscriptionServer(); server.run('0.0.0.0', 9090)\"")
|
56 |
-
return False
|
57 |
-
|
58 |
-
def start_recording(self):
|
59 |
-
"""Start recording audio from microphone"""
|
60 |
-
if not self.setup_client():
|
61 |
-
return
|
62 |
-
|
63 |
-
print("π€ Starting microphone transcription...")
|
64 |
-
print("Press Ctrl+C to stop")
|
65 |
-
|
66 |
-
try:
|
67 |
-
# Use the client for microphone transcription
|
68 |
-
self.client() # Call without parameters for microphone input
|
69 |
-
|
70 |
-
except Exception as e:
|
71 |
-
print(f"β Error during transcription: {e}")
|
72 |
-
|
73 |
-
def stop_recording(self):
|
74 |
-
"""Stop recording and cleanup"""
|
75 |
-
self.is_recording = False
|
76 |
-
print("\nπ Recording stopped")
|
77 |
-
|
78 |
-
def test_whisper_live():
|
79 |
-
"""Main function to test Whisper-Live"""
|
80 |
-
tester = WhisperLiveTerminalTest()
|
81 |
-
|
82 |
-
try:
|
83 |
-
tester.start_recording()
|
84 |
-
|
85 |
-
except KeyboardInterrupt:
|
86 |
-
print("\n\nπ Stopping test...")
|
87 |
-
tester.stop_recording()
|
88 |
-
print("β
Whisper-Live test completed")
|
89 |
-
|
90 |
-
if __name__ == "__main__":
|
91 |
-
test_whisper_live()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|