AliJabbarpour commited on
Commit
a0023f0
·
verified ·
1 Parent(s): 3344100

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -28,10 +28,11 @@ async def transcribe(websocket: WebSocket):
28
  tmp_path = None
29
 
30
  try:
31
- print("Step 1: waiting for bytes")
 
 
32
  audio_bytes = await websocket.receive_bytes()
33
  print(f"Step 2: received {len(audio_bytes)} bytes")
34
-
35
  await websocket.send_json({"status": "receiving"})
36
 
37
  with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp:
@@ -61,7 +62,10 @@ async def transcribe(websocket: WebSocket):
61
  "text": seg.text.strip(),
62
  "start": words[0].start,
63
  "end": words[-1].end,
64
- "words": [{"word": w.word, "start": w.start, "end": w.end} for w in words],
 
 
 
65
  })
66
  print(f"Step 6: got {len(segments)} segments")
67
 
 
28
  tmp_path = None
29
 
30
  try:
31
+ await websocket.send_json({"status": "connected"})
32
+ print("Step 1: sent connected signal, waiting for bytes")
33
+
34
  audio_bytes = await websocket.receive_bytes()
35
  print(f"Step 2: received {len(audio_bytes)} bytes")
 
36
  await websocket.send_json({"status": "receiving"})
37
 
38
  with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp:
 
62
  "text": seg.text.strip(),
63
  "start": words[0].start,
64
  "end": words[-1].end,
65
+ "words": [
66
+ {"word": w.word, "start": w.start, "end": w.end}
67
+ for w in words
68
+ ],
69
  })
70
  print(f"Step 6: got {len(segments)} segments")
71