Spaces:
Build error
Build error
test
Browse files- client/src/main.py +12 -1
client/src/main.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import time
|
2 |
import os
|
3 |
import httpx
|
@@ -37,6 +38,7 @@ def main():
|
|
37 |
|
38 |
print("\n🎤 Microphone is now listening...\n")
|
39 |
|
|
|
40 |
current_audio_chunk = AudioChunk(start_time=datetime.now(tz=UTC))
|
41 |
|
42 |
while True:
|
@@ -54,7 +56,16 @@ def main():
|
|
54 |
|
55 |
if current_audio_chunk.is_complete:
|
56 |
print('start serialize')
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
print('end serialize')
|
59 |
|
60 |
start = time.time()
|
|
|
1 |
+
import numpy as np
|
2 |
import time
|
3 |
import os
|
4 |
import httpx
|
|
|
38 |
|
39 |
print("\n🎤 Microphone is now listening...\n")
|
40 |
|
41 |
+
prev_audio_array = None
|
42 |
current_audio_chunk = AudioChunk(start_time=datetime.now(tz=UTC))
|
43 |
|
44 |
while True:
|
|
|
56 |
|
57 |
if current_audio_chunk.is_complete:
|
58 |
print('start serialize')
|
59 |
+
if prev_audio_array:
|
60 |
+
serialized = pickle.dumps(
|
61 |
+
np.concatenate(
|
62 |
+
prev_audio_array,
|
63 |
+
current_audio_chunk.audio_array
|
64 |
+
)
|
65 |
+
)
|
66 |
+
else:
|
67 |
+
serialized = pickle.dumps(current_audio_chunk.audio_array)
|
68 |
+
prev_audio_array = current_audio_chunk.audio_array
|
69 |
print('end serialize')
|
70 |
|
71 |
start = time.time()
|