Spaces:
Sleeping
Sleeping
AshDavid12
commited on
Commit
·
df340c3
1
Parent(s):
c72d2a4
added words
Browse files
infer.py
CHANGED
@@ -160,13 +160,14 @@ def transcribe_core_ws(audio_file, last_transcribed_time):
|
|
160 |
|
161 |
# Track the new segments and update the last transcribed time
|
162 |
for s in segs:
|
|
|
163 |
logging.info(f"Processing segment with start time: {s.start} and end time: {s.end}")
|
164 |
|
165 |
# Only process segments that start after the last transcribed time
|
166 |
if s.start >= last_transcribed_time:
|
167 |
logging.info(f"New segment found starting at {s.start} seconds.")
|
168 |
-
|
169 |
-
|
170 |
seg = {
|
171 |
'id': s.id, 'seek': s.seek, 'start': s.start, 'end': s.end, 'text': s.text,
|
172 |
'avg_logprob': s.avg_logprob, 'compression_ratio': s.compression_ratio,
|
@@ -179,7 +180,7 @@ def transcribe_core_ws(audio_file, last_transcribed_time):
|
|
179 |
new_last_transcribed_time = s.end
|
180 |
logging.debug(f"Updated last transcribed time to: {new_last_transcribed_time} seconds")
|
181 |
|
182 |
-
|
183 |
return ret, new_last_transcribed_time
|
184 |
|
185 |
|
|
|
160 |
|
161 |
# Track the new segments and update the last transcribed time
|
162 |
for s in segs:
|
163 |
+
words= []
|
164 |
logging.info(f"Processing segment with start time: {s.start} and end time: {s.end}")
|
165 |
|
166 |
# Only process segments that start after the last transcribed time
|
167 |
if s.start >= last_transcribed_time:
|
168 |
logging.info(f"New segment found starting at {s.start} seconds.")
|
169 |
+
for w in words:
|
170 |
+
words.append({'start': w.start, 'end': w.end, 'word': w.word, 'probability': w.probability})
|
171 |
seg = {
|
172 |
'id': s.id, 'seek': s.seek, 'start': s.start, 'end': s.end, 'text': s.text,
|
173 |
'avg_logprob': s.avg_logprob, 'compression_ratio': s.compression_ratio,
|
|
|
180 |
new_last_transcribed_time = s.end
|
181 |
logging.debug(f"Updated last transcribed time to: {new_last_transcribed_time} seconds")
|
182 |
|
183 |
+
logging.info(f"Returning {len(ret['new_segments'])} new segments and updated last transcribed time.")
|
184 |
return ret, new_last_transcribed_time
|
185 |
|
186 |
|