Spaces:
Sleeping
Sleeping
AshDavid12
commited on
Commit
·
c72d2a4
1
Parent(s):
fe056ae
last trascribed
Browse files
infer.py
CHANGED
@@ -184,7 +184,7 @@ def transcribe_core_ws(audio_file, last_transcribed_time):
|
|
184 |
|
185 |
|
186 |
import tempfile
|
187 |
-
|
188 |
|
189 |
@app.websocket("/wtranscribe")
|
190 |
async def websocket_transcribe(websocket: WebSocket):
|
@@ -194,6 +194,7 @@ async def websocket_transcribe(websocket: WebSocket):
|
|
194 |
|
195 |
try:
|
196 |
processed_segments = [] # Keeps track of the segments already transcribed
|
|
|
197 |
|
198 |
# A temporary file to store the growing audio data
|
199 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_audio_file:
|
@@ -221,11 +222,6 @@ async def websocket_transcribe(websocket: WebSocket):
|
|
221 |
}
|
222 |
logging.info(f"Sending {len(partial_result['new_segments'])} new segments to the client.")
|
223 |
processed_segments.extend(partial_result['new_segments'])
|
224 |
-
|
225 |
-
# Reset the accumulated audio size after transcription
|
226 |
-
|
227 |
-
# Send the transcription result back to the client with both new and all processed segments
|
228 |
-
|
229 |
await websocket.send_json(response)
|
230 |
|
231 |
except WebSocketDisconnect:
|
|
|
184 |
|
185 |
|
186 |
import tempfile
|
187 |
+
|
188 |
|
189 |
@app.websocket("/wtranscribe")
|
190 |
async def websocket_transcribe(websocket: WebSocket):
|
|
|
194 |
|
195 |
try:
|
196 |
processed_segments = [] # Keeps track of the segments already transcribed
|
197 |
+
last_transcribed_time = 0.0
|
198 |
|
199 |
# A temporary file to store the growing audio data
|
200 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_audio_file:
|
|
|
222 |
}
|
223 |
logging.info(f"Sending {len(partial_result['new_segments'])} new segments to the client.")
|
224 |
processed_segments.extend(partial_result['new_segments'])
|
|
|
|
|
|
|
|
|
|
|
225 |
await websocket.send_json(response)
|
226 |
|
227 |
except WebSocketDisconnect:
|