Aster
commited on
Commit
•
68cea2d
1
Parent(s):
75e5423
Add test codes
Browse files- src/main.rs +15 -0
src/main.rs
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use std::path::PathBuf;
|
2 |
+
|
3 |
+
use image::io::Reader;
|
4 |
+
|
5 |
+
use waifu2x::{Convolution7, DenoiseLevel, Environment};
|
6 |
+
|
7 |
+
fn main() {
|
8 |
+
let here = PathBuf::from(".").canonicalize().unwrap();
|
9 |
+
println!("here: {}", here.display());
|
10 |
+
let env = Environment::default().into_arc();
|
11 |
+
let mut model = Convolution7::new(&env, &PathBuf::from("models/upconv7"), DenoiseLevel::High).unwrap();
|
12 |
+
let image = Reader::open("tests/miku.png").unwrap().decode().unwrap();
|
13 |
+
let out = model.upscale_2x(&image).unwrap();
|
14 |
+
out.save("tests/miku_conv7.png").unwrap();
|
15 |
+
}
|