aviadr1 commited on
Commit
869d858
·
2 Parent(s): 9d710fb d82fb72

Merge branch 'main' of https://huggingface.co/spaces/Gigaverse/ivrit-ai-streaming

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
@@ -292,7 +292,12 @@ async def websocket_transcribe(websocket: WebSocket):
292
  try:
293
  # Receive the next chunk of PCM audio data
294
  logging.info("in try before recive ")
295
- audio_chunk = await asyncio.wait_for(websocket.receive_bytes(), timeout=10.0)
 
 
 
 
 
296
 
297
  logging.info("after recieve")
298
  sys.stdout.flush()
 
292
  try:
293
  # Receive the next chunk of PCM audio data
294
  logging.info("in try before recive ")
295
+ audio_chunk = await websocket.receive_bytes()
296
+ if isinstance(audio_chunk, bytes):
297
+ print("is instance ")
298
+ else:
299
+ print("is instance NOT")
300
+
301
 
302
  logging.info("after recieve")
303
  sys.stdout.flush()