Spaces:
Paused
Paused
Update simple_app.py
Browse files- simple_app.py +10 -5
simple_app.py
CHANGED
@@ -62,19 +62,24 @@ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
|
|
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 |
-
|
|
|
|
|
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.desc = f"Overall Process MICHEL- {percentage:.1f}% | {msg}"
|
75 |
overall_bar.refresh()
|
76 |
else:
|
77 |
-
# Print any other lines.
|
78 |
print(stripped_line)
|
79 |
|
80 |
process.wait()
|
|
|
62 |
|
63 |
# Check for INFO lines.
|
64 |
if "INFO:" in stripped_line:
|
65 |
+
# Extract the text after "INFO:"
|
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 few irrelevant steps.
|
71 |
if processed_steps < irrelevant_steps:
|
72 |
processed_steps += 1
|
73 |
else:
|
74 |
+
# Create a sub-progress bar with a total of 1 for this step.
|
75 |
+
sub_bar = tqdm(total=1, desc=msg, position=2, ncols=120, dynamic_ncols=False, leave=True)
|
76 |
+
sub_bar.update(1)
|
77 |
+
sub_bar.close()
|
78 |
+
|
79 |
+
# Update the overall progress bar.
|
80 |
overall_bar.update(1)
|
|
|
|
|
|
|
81 |
overall_bar.refresh()
|
82 |
else:
|
|
|
83 |
print(stripped_line)
|
84 |
|
85 |
process.wait()
|