eeshaAI commited on
Commit
2c311a6
·
verified ·
1 Parent(s): e8cf613

Fix: efficient log reading (last 5000 chars only)

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -298,7 +298,12 @@ def _tokens_to_color(token_ids, grid_h=8, grid_w=8):
298
  def get_log():
299
  try:
300
  with open(LOG_FILE, "r") as f:
301
- return f.read()
 
 
 
 
 
302
  except:
303
  return "No pipeline log yet."
304
 
 
298
  def get_log():
299
  try:
300
  with open(LOG_FILE, "r") as f:
301
+ # Only read the last 5000 chars for efficiency
302
+ f.seek(0, 2) # seek to end
303
+ size = f.tell()
304
+ f.seek(max(0, size - 5000))
305
+ content = f.read()
306
+ return content
307
  except:
308
  return "No pipeline log yet."
309