Download models.rs from montreal-forced-align-polygot/MFA-RUST: direct link, hf CLI and curl.
- Browser
- Download file 2.08 kB
-
https://huggingface.co/spaces/montreal-forced-align-polygot/MFA-RUST/resolve/main/models.rs
- Command line
-
hf download hf://spaces/montreal-forced-align-polygot/MFA-RUST/models.rs
-
curl -L -o models.rs https://huggingface.co/spaces/montreal-forced-align-polygot/MFA-RUST/resolve/main/models.rs
2.08 kB
| use chrono::{DateTime, Utc}; | |
| use serde::{Deserialize, Serialize}; | |
| pub struct AlignRequest { | |
| pub audio_base64: String, | |
| pub text: String, | |
| pub language: String, | |
| pub pass_number: i32, | |
| pub client_id: Option<String>, | |
| } | |
| fn default_language() -> String { | |
| "english".to_string() | |
| } | |
| fn default_pass_number() -> i32 { | |
| 1 | |
| } | |
| pub struct CancelRequest { | |
| pub client_id: Option<String>, | |
| } | |
| pub struct JobQuery { | |
| pub slim: Option<bool>, | |
| } | |
| pub enum JobStatus { | |
| Queued, | |
| Running, | |
| Completed, | |
| Failed, | |
| Abandoned, | |
| } | |
| impl JobStatus { | |
| pub fn as_str(&self) -> &'static str { | |
| match self { | |
| JobStatus::Queued => "queued", | |
| JobStatus::Running => "running", | |
| JobStatus::Completed => "completed", | |
| JobStatus::Failed => "failed", | |
| JobStatus::Abandoned => "abandoned", | |
| } | |
| } | |
| } | |
| pub struct WordTimestamp { | |
| pub word: String, | |
| pub start: f64, | |
| pub end: f64, | |
| } | |
| pub struct Job { | |
| pub id: String, | |
| pub request: AlignRequest, | |
| pub status: JobStatus, | |
| pub created_at: DateTime<Utc>, | |
| pub started_at: Option<DateTime<Utc>>, | |
| pub terminal_at: Option<DateTime<Utc>>, | |
| pub result: Option<Vec<WordTimestamp>>, | |
| pub error: Option<String>, | |
| pub client_id: Option<String>, | |
| pub audio_duration: f64, | |
| pub wav_path: String, | |
| pub cleaned_text: String, | |
| } | |
| pub struct Metrics { | |
| pub total_submitted: i32, | |
| pub total_completed: i32, | |
| pub total_failed: i32, | |
| pub total_abandoned: i32, | |
| pub total_cancelled: i32, | |
| pub start_time: Option<DateTime<Utc>>, | |
| } | |
| impl Metrics { | |
| pub fn new() -> Self { | |
| Self { | |
| start_time: Some(Utc::now()), | |
| ..Default::default() | |
| } | |
| } | |
| } |