fffiloni commited on
Commit
a0044b5
·
verified ·
1 Parent(s): 91dbeb2

Update simple_app.py

Browse files
Files changed (1) hide show
  1. simple_app.py +8 -9
simple_app.py CHANGED
@@ -20,11 +20,9 @@ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
20
  overall_bar = tqdm(total=relevant_steps, desc="Overall Process", position=1, dynamic_ncols=True, leave=True)
21
  processed_steps = 0
22
 
23
- # Regex to extract the INFO message (everything after "INFO:")
24
- info_pattern = re.compile(r"\[.*?\]\s+INFO:\s+(.*)")
25
  # Regex to capture video generation progress lines (e.g., " 10%|...| 5/50")
26
  progress_pattern = re.compile(r"(\d+)%\|.*\| (\d+)/(\d+)")
27
-
28
  gen_progress_bar = None
29
 
30
  command = [
@@ -64,19 +62,20 @@ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
64
  gen_progress_bar.refresh()
65
  continue # Skip further processing for progress lines
66
 
67
- # Check if this is an INFO log line.
68
- info_match = info_pattern.search(stripped_line)
69
- if info_match:
70
- msg = info_match.group(1)
 
71
  # Print the raw log line.
72
  tqdm.write(stripped_line)
73
- # For relevant steps (after the first three), update the overall progress bar.
74
  if processed_steps < irrelevant_steps:
75
  processed_steps += 1
76
  else:
77
  overall_bar.update(1)
78
  percentage = (overall_bar.n / overall_bar.total) * 100
79
- # Directly insert the INFO message in the description.
80
  overall_bar.set_description(f"Overall Process - {percentage:.1f}% | {msg}")
81
  overall_bar.refresh()
82
  else:
 
20
  overall_bar = tqdm(total=relevant_steps, desc="Overall Process", position=1, dynamic_ncols=True, leave=True)
21
  processed_steps = 0
22
 
 
 
23
  # Regex to capture video generation progress lines (e.g., " 10%|...| 5/50")
24
  progress_pattern = re.compile(r"(\d+)%\|.*\| (\d+)/(\d+)")
25
+
26
  gen_progress_bar = None
27
 
28
  command = [
 
62
  gen_progress_bar.refresh()
63
  continue # Skip further processing for progress lines
64
 
65
+ # Now check if the line contains an "INFO:" message.
66
+ if "INFO:" in stripped_line:
67
+ # Use split to capture everything after "INFO:".
68
+ parts = stripped_line.split("INFO:", 1)
69
+ msg = parts[1].strip() if len(parts) > 1 else ""
70
  # Print the raw log line.
71
  tqdm.write(stripped_line)
72
+ # For relevant steps (after the first three), update the overall progress.
73
  if processed_steps < irrelevant_steps:
74
  processed_steps += 1
75
  else:
76
  overall_bar.update(1)
77
  percentage = (overall_bar.n / overall_bar.total) * 100
78
+ # Directly insert the INFO message into the description.
79
  overall_bar.set_description(f"Overall Process - {percentage:.1f}% | {msg}")
80
  overall_bar.refresh()
81
  else: