ming commited on
Commit
698636a
·
1 Parent(s): 353272e

Comment out asyncio.sleep for better streaming performance

Browse files
app/services/hf_streaming_summarizer.py CHANGED
@@ -339,7 +339,7 @@ class HFStreamingSummarizer:
339
  generation_thread.start()
340
 
341
  # Stream tokens as they arrive
342
- token_count = 0
343
  for text_chunk in streamer:
344
  if text_chunk: # Skip empty chunks
345
  yield {
@@ -350,7 +350,7 @@ class HFStreamingSummarizer:
350
  token_count += 1
351
 
352
  # Small delay for streaming effect
353
- await asyncio.sleep(0.01)
354
 
355
  # Wait for generation to complete
356
  generation_thread.join()
 
339
  generation_thread.start()
340
 
341
  # Stream tokens as they arrive
342
+ token_count =0
343
  for text_chunk in streamer:
344
  if text_chunk: # Skip empty chunks
345
  yield {
 
350
  token_count += 1
351
 
352
  # Small delay for streaming effect
353
+ # await asyncio.sleep(0.01)
354
 
355
  # Wait for generation to complete
356
  generation_thread.join()