mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
some tweaks to f5 inference
This commit is contained in:
1 parent
83764e2381
commit
4ebb7fe282
3 files changed
+10
-28
No files matched your search
+4
-21
@@ -52,14 +52,9 @@ pub struct InferenceArgs<'s> {
|
||||
pub reference_audio_path: &'s Path,
|
||||
|
||||
pub reference_transcript_path: Option<&'s Path>,
|
||||
pub reference_language : Option<&'s str>,
|
||||
|
||||
//pub output_audio_directory: &'s Path,
|
||||
pub output_file_path: &'s Path,
|
||||
|
||||
pub maybe_reference_free: Option<bool>,
|
||||
pub maybe_temperature: Option<f32>,
|
||||
pub maybe_target_language: Option<&'s str>,
|
||||
pub output_audio_directory: &'s Path,
|
||||
// pub output_file_path: &'s Path,
|
||||
}
|
||||
|
||||
impl F5TTSInferenceCommand {
|
||||
@@ -153,24 +148,12 @@ impl F5TTSInferenceCommand {
|
||||
}
|
||||
}
|
||||
|
||||
command.push_str(&format!(" --target_text {}", path_to_string(args.input_text_file)));
|
||||
command.push_str(&format!(" --gen_file {}", path_to_string(args.input_text_file)));
|
||||
command.push_str(&format!(" --ref_audio {}", path_to_string(args.reference_audio_path)));
|
||||
|
||||
|
||||
//command.push_str(&format!(" --output_path {}", path_to_string(args.output_audio_directory)));
|
||||
command.push_str(&format!(" --output_path {}", path_to_string(args.output_file_path)));
|
||||
|
||||
if let Some(reference_free) = args.maybe_reference_free {
|
||||
command.push_str(&format!(" --ref_free {}", reference_free));
|
||||
}
|
||||
|
||||
if let Some(temperature) = args.maybe_temperature {
|
||||
command.push_str(&format!(" --temperature {}", temperature));
|
||||
}
|
||||
|
||||
if let Some(target_language) = args.maybe_target_language {
|
||||
command.push_str(&format!(" --target_language {}", target_language));
|
||||
}
|
||||
command.push_str(&format!(" --output_dir {}", path_to_string(args.output_audio_directory)));
|
||||
|
||||
if let Some(maybe_docker_options) = self.maybe_docker_options.as_ref() {
|
||||
command = maybe_docker_options.to_command_string(&command);
|
||||
|
||||
+2
-7
@@ -68,7 +68,7 @@ pub async fn process_single_f5_tts_inference_job(
|
||||
.map_err(|e| ProcessSingleJobError::from_io_error(e))?;
|
||||
|
||||
let output_dir = work_temp_dir.path().join("output");
|
||||
let output_file_path = output_dir.join("GPTSoVITS_1.wav");
|
||||
let output_file_path = output_dir.join("out.wav");
|
||||
|
||||
if !output_dir.exists() {
|
||||
std::fs::create_dir_all(&output_dir)
|
||||
@@ -164,7 +164,6 @@ pub async fn process_single_f5_tts_inference_job(
|
||||
original_media_upload_fs_path
|
||||
};
|
||||
|
||||
const DEFAULT_LANGUAGE : &str = "english";
|
||||
|
||||
let inference_start_time = Instant::now();
|
||||
|
||||
@@ -176,11 +175,7 @@ pub async fn process_single_f5_tts_inference_job(
|
||||
reference_audio_path: &original_media_upload_fs_path,
|
||||
input_text_file: &text_input_fs_path,
|
||||
reference_transcript_path: None,
|
||||
reference_language: Some(DEFAULT_LANGUAGE),
|
||||
output_file_path: &output_file_path,
|
||||
maybe_reference_free: None,
|
||||
maybe_temperature: None,
|
||||
maybe_target_language: Some(DEFAULT_LANGUAGE),
|
||||
output_audio_directory: &output_dir,
|
||||
});
|
||||
|
||||
let inference_duration = Instant::now().duration_since(inference_start_time);
|
||||
|
||||
@@ -300,6 +300,10 @@ fn add_tts_routes<T, B> (app: App<T>) -> App<T>
|
||||
app.service(web::resource("/v1/tts/inference")
|
||||
.route(web::post().to(enqueue_infer_tts_handler))
|
||||
.route(web::head().to(|| HttpResponse::Ok()))
|
||||
)
|
||||
.service(web::resource("/v1/tts/f5_inference")
|
||||
.route(web::post().to(enqueue_infer_f5_tts_handler))
|
||||
.route(web::head().to(|| HttpResponse::Ok()))
|
||||
)
|
||||
// NB(bt,2024-04-03): Older root /tts/* routes should be drained of traffic. They are used in the Twitch Streamer API though.
|
||||
.service(
|
||||
|
||||
Reference in new issue
Block a user