Spaces:
Running
Running
File size: 1,202 Bytes
a5855f7 de6fe87 0cbe68c 82cfdd6 a5855f7 82cfdd6 a5855f7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
from gradio_client import Client, handle_file
import os
hf_token=os.getenv("your_huggingface_token")
client = Client("ResembleAI/Chatterbox", hf_token)
# client = Client("ResembleAI/Chatterbox")
# result = client.predict(
# text_input="Now let's make my mum's favourite. So three mars bars into the pan. Then we add the tuna and just stir for a bit, just let the chocolate and fish infuse. A sprinkle of olive oil and some tomato ketchup. Now smell that. Oh boy this is going to be incredible.",
# audio_prompt_path_input=handle_file('https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample.wav'),
# exaggeration_input=0.5,
# temperature_input=0.8,
# seed_num_input=0,
# cfgw_input=0.5,
# api_name="/generate_tts_audio"
)
try:
result = client.predict(
text_input=text_input,
audio_prompt_path_input=handle_file(audio_prompt_url),
exaggeration_input=exaggeration_input,
temperature_input=temperature_input,
seed_num_input=seed_num_input,
cfgw_input=cfgw_input,
api_name="/generate_tts_audio"
)
except Exception as e:
print(f"An error occurred: {e}")
return "Error generating audio"
print(result) |