1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::thread;
use std::time::Duration;

use avance::*;

fn main() {
    // Suppose we're training a model and here's 200 epoches
    let epoch = 200;
    let mut accuracy = 30.0;

    (0..epoch)
        .avance()
        .with_style(Style::Block)
        .with_pb()
        .for_each(|(_, pb)| {
            thread::sleep(Duration::from_millis(20));

            accuracy += 0.34;

            // Display the accuracy through the postfix
            pb.set_postfix(format!("acc={:.2}", accuracy));
        });
}