mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
intermediate plumbing for new vocoders
This commit is contained in:
1 parent
c9112b7714
commit
21cffc1f03
6 files changed
+100
-33
No files matched your search
@@ -1 +1,2 @@
|
||||
pub mod record_visibility;
|
||||
pub mod record_visibility;
|
||||
pub mod vocoder_type;
|
||||
@@ -0,0 +1,29 @@
|
||||
//! These denote the pretrained vocoders
|
||||
|
||||
use anyhow::anyhow;
|
||||
use crate::util::anyhow_result::AnyhowResult;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize, sqlx::Type)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[sqlx(rename_all = "lowercase")]
|
||||
pub enum VocoderType {
|
||||
HifiGanSuperSample,
|
||||
WaveGlow,
|
||||
}
|
||||
|
||||
impl VocoderType {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
VocoderType::HifiGanSuperSample => "hifigan-supersample",
|
||||
VocoderType::WaveGlow => "waveglow",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_str(vocoder_type: &str) -> AnyhowResult<Self> {
|
||||
match vocoder_type {
|
||||
"hifigan-supersample" => Ok(VocoderType::HifiGanSuperSample),
|
||||
"waveglow" => Ok(VocoderType::WaveGlow),
|
||||
_ => Err(anyhow!("invalid value: {:?}", vocoder_type)),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user