fix the script at the end of this message. referencetext is a str maxnewtokens is a…
- User
fix the script at the end of this message.
reference_text is a str max_new_tokens is a float chunk_length is a float top_p is a float repetition_penalty is a float temperature is a float seed is a int as a str
from gradio_client import Client, handle_file import os import shutil import sys
def move_wav_file(src_path, dst_path): """ Moves a .wav file from the source directory to the destination directory. :param src_path: The full path to the source .wav file. :param dst_path: The full path to the destination directory. """ # Check if the source file exists if not os.path.isfile(src_path): print(f"Source file '{src_path}' does not exist.") return
code# Check if the destination directory exists, if not, create it if not os.path.isdir(dst_path): os.makedirs(dst_path) print(f"Destination directory '{dst_path}' created.") # Get the base name of the file file_name = os.path.basename(src_path) # Construct the full destination path dst_file_path = os.path.join(dst_path, file_name) # Move the file try: shutil.move(src_path, dst_file_path) print(f"File '{file_name}' moved successfully to '{dst_path}'.") except Exception as e: print(f"An error occurred while moving the file: {e}")Example usage
dst_path = '/mnt/h/Hot/fish-speech-1.4.1/API/' # Updated to WSL path client = Client("http://localhost:7860/") result = client.predict( text=sys.argv[1], enable_reference_audio=True, reference_audio=handle_file(sys.argv[2]), reference_text=sys.argv[3], max_new_tokens=sys.argv[4], chunk_length=sys.argv[5], top_p=sys.argv[6], repetition_penalty=sys.argv[7], temperature=sys.argv[8], seed=str(sys.argv[9]), batch_infer_num=1, api_name="/inference_wrapper" )
Extract and print only the file path of the WAV file
wav_file_path = result[1]['value'] if result and isinstance(result, tuple) and len(result) > 1 else None print(wav_file_path)
src_path = wav_file_path move_wav_file(src_path, dst_path)
- Assistant