Spaces:
Sleeping
Sleeping
AshDavid12
commited on
Commit
·
3321dc8
1
Parent(s):
5ac76de
new segs change
Browse files
client.py
CHANGED
@@ -48,7 +48,7 @@ async def send_audio(websocket):
|
|
48 |
# Send buffered audio data once it's large enough
|
49 |
if len(audio_buffer) >= buffer_size:
|
50 |
await websocket.send(audio_buffer)
|
51 |
-
|
52 |
audio_buffer.clear()
|
53 |
await asyncio.sleep(0.01)
|
54 |
|
@@ -87,7 +87,7 @@ async def run_client():
|
|
87 |
ssl_context.check_hostname = False
|
88 |
ssl_context.verify_mode = ssl.CERT_NONE
|
89 |
|
90 |
-
async with websockets.connect(uri, ssl=ssl_context, timeout=
|
91 |
await asyncio.gather(
|
92 |
send_audio(websocket),
|
93 |
receive_transcription(websocket),
|
|
|
48 |
# Send buffered audio data once it's large enough
|
49 |
if len(audio_buffer) >= buffer_size:
|
50 |
await websocket.send(audio_buffer)
|
51 |
+
print(f"Sent {len(audio_buffer)} bytes of audio data.")
|
52 |
audio_buffer.clear()
|
53 |
await asyncio.sleep(0.01)
|
54 |
|
|
|
87 |
ssl_context.check_hostname = False
|
88 |
ssl_context.verify_mode = ssl.CERT_NONE
|
89 |
|
90 |
+
async with websockets.connect(uri, ssl=ssl_context, timeout=600) as websocket:
|
91 |
await asyncio.gather(
|
92 |
send_audio(websocket),
|
93 |
receive_transcription(websocket),
|
infer.py
CHANGED
@@ -218,7 +218,7 @@ async def websocket_transcribe(websocket: WebSocket):
|
|
218 |
accumulated_audio_time = 0 # Reset the accumulated audio time
|
219 |
|
220 |
response = {
|
221 |
-
"new_segments": partial_result
|
222 |
"processed_segments": processed_segments
|
223 |
}
|
224 |
logging.info(f"Sending {len(partial_result['new_segments'])} new segments to the client.")
|
|
|
218 |
accumulated_audio_time = 0 # Reset the accumulated audio time
|
219 |
|
220 |
response = {
|
221 |
+
"new_segments": partial_result,
|
222 |
"processed_segments": processed_segments
|
223 |
}
|
224 |
logging.info(f"Sending {len(partial_result['new_segments'])} new segments to the client.")
|