use crate::download::{vision::Vision, AvailableOnnxModel, ModelUrl};
#[derive(Debug, Clone)]
pub enum ImageManipulation {
SuperResolution,
FastNeuralStyleTransfer(FastNeuralStyleTransferStyle),
}
#[derive(Debug, Clone)]
pub enum FastNeuralStyleTransferStyle {
Mosaic,
Candy,
RainPrincess,
Udnie,
Pointilism,
}
impl ModelUrl for ImageManipulation {
fn fetch_url(&self) -> &'static str {
match self {
ImageManipulation::SuperResolution => "https://github.com/onnx/models/raw/master/vision/super_resolution/sub_pixel_cnn_2016/model/super-resolution-10.onnx",
ImageManipulation::FastNeuralStyleTransfer(style) => style.fetch_url(),
}
}
}
impl ModelUrl for FastNeuralStyleTransferStyle {
fn fetch_url(&self) -> &'static str {
match self {
FastNeuralStyleTransferStyle::Mosaic => "https://github.com/onnx/models/raw/master/vision/style_transfer/fast_neural_style/model/mosaic-9.onnx",
FastNeuralStyleTransferStyle::Candy => "https://github.com/onnx/models/raw/master/vision/style_transfer/fast_neural_style/model/candy-9.onnx",
FastNeuralStyleTransferStyle::RainPrincess => "https://github.com/onnx/models/raw/master/vision/style_transfer/fast_neural_style/model/rain-princess-9.onnx",
FastNeuralStyleTransferStyle::Udnie => "https://github.com/onnx/models/raw/master/vision/style_transfer/fast_neural_style/model/udnie-9.onnx",
FastNeuralStyleTransferStyle::Pointilism => "https://github.com/onnx/models/raw/master/vision/style_transfer/fast_neural_style/model/pointilism-9.onnx",
}
}
}
impl From<ImageManipulation> for AvailableOnnxModel {
fn from(model: ImageManipulation) -> Self {
AvailableOnnxModel::Vision(Vision::ImageManipulation(model))
}
}
impl From<FastNeuralStyleTransferStyle> for AvailableOnnxModel {
fn from(style: FastNeuralStyleTransferStyle) -> Self {
AvailableOnnxModel::Vision(Vision::ImageManipulation(
ImageManipulation::FastNeuralStyleTransfer(style),
))
}
}