fffiloni commited on
Commit
765b867
·
verified ·
1 Parent(s): b6ab24c

Update simple_app.py

Browse files
Files changed (1) hide show
  1. simple_app.py +3 -7
simple_app.py CHANGED
@@ -62,20 +62,16 @@ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
62
 
63
  # Check for INFO lines.
64
  if "INFO:" in stripped_line:
65
- # Split the line at "INFO:" to extract the message.
66
  parts = stripped_line.split("INFO:", 1)
67
  msg = parts[1].strip() if len(parts) > 1 else ""
68
- # Print the log line.
69
- print(stripped_line)
70
- # Skip updating the overall bar for the first three (irrelevant) steps.
71
  if processed_steps < irrelevant_steps:
72
  processed_steps += 1
73
  else:
74
  overall_bar.update(1)
75
  percentage = (overall_bar.n / overall_bar.total) * 100
76
- overall_bar.set_description(f"Overall Process - {percentage:.1f}%")
77
- overall_bar.set_postfix_str(msg)
78
- print(msg)
79
  overall_bar.refresh()
80
  else:
81
  # Print any other lines.
 
62
 
63
  # Check for INFO lines.
64
  if "INFO:" in stripped_line:
 
65
  parts = stripped_line.split("INFO:", 1)
66
  msg = parts[1].strip() if len(parts) > 1 else ""
67
+ tqdm.write(stripped_line) # Use tqdm.write() instead of print()
 
 
68
  if processed_steps < irrelevant_steps:
69
  processed_steps += 1
70
  else:
71
  overall_bar.update(1)
72
  percentage = (overall_bar.n / overall_bar.total) * 100
73
+ # Combine percentage and INFO message into one description.
74
+ overall_bar.set_description(f"Overall Process - {percentage:.1f}% | {msg}")
 
75
  overall_bar.refresh()
76
  else:
77
  # Print any other lines.