AshDavid12 commited on
Commit
d82fb72
·
1 Parent(s): 228afd7

insepcting recive bytes in server

Browse files
Files changed (2) hide show
  1. client.py +1 -1
  2. infer.py +6 -1
client.py CHANGED
@@ -66,7 +66,7 @@ async def send_audio(websocket):
66
  for i in range(0, len(raw_data), buffer_size):
67
  pcm_chunk = raw_data[i:i + buffer_size]
68
  await websocket.send(pcm_chunk) # Send raw PCM data chunk
69
- #logging.info(f"Sent PCM chunk of size {len(pcm_chunk)} bytes.")
70
  await asyncio.sleep(0.01) # Simulate real-time sending
71
 
72
  logging.info("Completed sending all audio data.")
 
66
  for i in range(0, len(raw_data), buffer_size):
67
  pcm_chunk = raw_data[i:i + buffer_size]
68
  await websocket.send(pcm_chunk) # Send raw PCM data chunk
69
+ logging.info(f"Sent PCM chunk of size {len(pcm_chunk)} bytes.")
70
  await asyncio.sleep(0.01) # Simulate real-time sending
71
 
72
  logging.info("Completed sending all audio data.")
infer.py CHANGED
@@ -230,7 +230,12 @@ async def websocket_transcribe(websocket: WebSocket):
230
  try:
231
  # Receive the next chunk of PCM audio data
232
  logging.info("in try before recive ")
233
- audio_chunk = await asyncio.wait_for(websocket.receive_bytes(), timeout=10.0)
 
 
 
 
 
234
 
235
  logging.info("after recieve")
236
  sys.stdout.flush()
 
230
  try:
231
  # Receive the next chunk of PCM audio data
232
  logging.info("in try before recive ")
233
+ audio_chunk = await websocket.receive_bytes()
234
+ if isinstance(audio_chunk, bytes):
235
+ print("is instance ")
236
+ else:
237
+ print("is instance NOT")
238
+
239
 
240
  logging.info("after recieve")
241
  sys.stdout.flush()