Merge pull request #155 from SD-inst/format
This commit is contained in:
@@ -1533,17 +1533,13 @@ class ACEStepPipeline:
|
|||||||
base_path = f"./outputs"
|
base_path = f"./outputs"
|
||||||
ensure_directory_exists(base_path)
|
ensure_directory_exists(base_path)
|
||||||
output_path_wav = (
|
output_path_wav = (
|
||||||
f"{base_path}/output_{time.strftime('%Y%m%d%H%M%S')}_{idx}.wav"
|
f"{base_path}/output_{time.strftime('%Y%m%d%H%M%S')}_{idx}."+format
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
ensure_directory_exists(os.path.dirname(save_path))
|
ensure_directory_exists(os.path.dirname(save_path))
|
||||||
if os.path.isdir(save_path):
|
if os.path.isdir(save_path):
|
||||||
logger.info(
|
logger.info(f"Provided save_path '{save_path}' is a directory. Appending timestamped filename.")
|
||||||
f"Provided save_path '{save_path}' is a directory. Appending timestamped filename."
|
output_path_wav = os.path.join(save_path, f"output_{time.strftime('%Y%m%d%H%M%S')}_{idx}."+format)
|
||||||
)
|
|
||||||
output_path_wav = os.path.join(
|
|
||||||
save_path, f"output_{time.strftime('%Y%m%d%H%M%S')}_{idx}.wav"
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
output_path_wav = save_path
|
output_path_wav = save_path
|
||||||
|
|
||||||
@@ -1582,6 +1578,7 @@ class ACEStepPipeline:
|
|||||||
|
|
||||||
def __call__(
|
def __call__(
|
||||||
self,
|
self,
|
||||||
|
format: str = "wav",
|
||||||
audio_duration: float = 60.0,
|
audio_duration: float = 60.0,
|
||||||
prompt: str = None,
|
prompt: str = None,
|
||||||
lyrics: str = None,
|
lyrics: str = None,
|
||||||
@@ -1616,7 +1613,6 @@ class ACEStepPipeline:
|
|||||||
edit_n_max: float = 1.0,
|
edit_n_max: float = 1.0,
|
||||||
edit_n_avg: int = 1,
|
edit_n_avg: int = 1,
|
||||||
save_path: str = None,
|
save_path: str = None,
|
||||||
format: str = "wav",
|
|
||||||
batch_size: int = 1,
|
batch_size: int = 1,
|
||||||
debug: bool = False,
|
debug: bool = False,
|
||||||
):
|
):
|
||||||
@@ -1832,6 +1828,7 @@ class ACEStepPipeline:
|
|||||||
}
|
}
|
||||||
|
|
||||||
input_params_json = {
|
input_params_json = {
|
||||||
|
"format": format,
|
||||||
"lora_name_or_path": lora_name_or_path,
|
"lora_name_or_path": lora_name_or_path,
|
||||||
"task": task,
|
"task": task,
|
||||||
"prompt": prompt if task != "edit" else edit_target_prompt,
|
"prompt": prompt if task != "edit" else edit_target_prompt,
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ def create_text2music_ui(
|
|||||||
info="-1 means random duration (30 ~ 240).",
|
info="-1 means random duration (30 ~ 240).",
|
||||||
scale=9,
|
scale=9,
|
||||||
)
|
)
|
||||||
|
format = gr.Dropdown(choices=["mp3", "ogg", "flac", "wav"], value="wav", label="Format")
|
||||||
sample_bnt = gr.Button("Sample", variant="secondary", scale=1)
|
sample_bnt = gr.Button("Sample", variant="secondary", scale=1)
|
||||||
|
|
||||||
# audio2audio
|
# audio2audio
|
||||||
@@ -320,6 +321,7 @@ def create_text2music_ui(
|
|||||||
|
|
||||||
def retake_process_func(json_data, retake_variance, retake_seeds):
|
def retake_process_func(json_data, retake_variance, retake_seeds):
|
||||||
return text2music_process_func(
|
return text2music_process_func(
|
||||||
|
json_data["format"],
|
||||||
json_data["audio_duration"],
|
json_data["audio_duration"],
|
||||||
json_data["prompt"],
|
json_data["prompt"],
|
||||||
json_data["lyrics"],
|
json_data["lyrics"],
|
||||||
@@ -448,6 +450,7 @@ def create_text2music_ui(
|
|||||||
src_audio_path = json_data["audio_path"]
|
src_audio_path = json_data["audio_path"]
|
||||||
|
|
||||||
return text2music_process_func(
|
return text2music_process_func(
|
||||||
|
format.value,
|
||||||
json_data["audio_duration"],
|
json_data["audio_duration"],
|
||||||
prompt,
|
prompt,
|
||||||
lyrics,
|
lyrics,
|
||||||
@@ -621,6 +624,7 @@ def create_text2music_ui(
|
|||||||
edit_lyrics = lyrics
|
edit_lyrics = lyrics
|
||||||
|
|
||||||
return text2music_process_func(
|
return text2music_process_func(
|
||||||
|
format.value,
|
||||||
json_data["audio_duration"],
|
json_data["audio_duration"],
|
||||||
prompt,
|
prompt,
|
||||||
lyrics,
|
lyrics,
|
||||||
@@ -767,6 +771,7 @@ def create_text2music_ui(
|
|||||||
repaint_start = -left_extend_length
|
repaint_start = -left_extend_length
|
||||||
repaint_end = json_data["audio_duration"] + right_extend_length
|
repaint_end = json_data["audio_duration"] + right_extend_length
|
||||||
return text2music_process_func(
|
return text2music_process_func(
|
||||||
|
format.value,
|
||||||
json_data["audio_duration"],
|
json_data["audio_duration"],
|
||||||
prompt,
|
prompt,
|
||||||
lyrics,
|
lyrics,
|
||||||
@@ -938,6 +943,7 @@ def create_text2music_ui(
|
|||||||
text2music_bnt.click(
|
text2music_bnt.click(
|
||||||
fn=text2music_process_func,
|
fn=text2music_process_func,
|
||||||
inputs=[
|
inputs=[
|
||||||
|
format,
|
||||||
audio_duration,
|
audio_duration,
|
||||||
prompt,
|
prompt,
|
||||||
lyrics,
|
lyrics,
|
||||||
|
|||||||
Reference in New Issue
Block a user