Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions simulstreaming/whisper/whisper_streaming/whisper_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,14 @@ def send_result(self, iteration_output):
# - the next words: segment transcript
if iteration_output:
if self.out_txt:
message = "%1.0f %1.0f %s" % (iteration_output['start'] * 1000, iteration_output['end'] * 1000, iteration_output['text'])
if 'text' in iteration_output:
message = "%1.0f %1.0f %s" % (iteration_output['start'] * 1000, iteration_output['end'] * 1000, iteration_output['text'])
print(message, flush=True, file=sys.stderr)
self.connection.send(message)
else:
message = json.dumps(iteration_output)
print(message, flush=True, file=sys.stderr)
self.connection.send(message)
print(message, flush=True, file=sys.stderr)
self.connection.send(message)
else:
logger.debug("No text in this segment")

Expand Down Expand Up @@ -152,4 +155,4 @@ def main_server(factory, add_args):
proc.process()
conn.close()
logger.info('Connection to client closed')
logger.info('Connection closed, terminating.')
logger.info('Connection closed, terminating.')