Greetings to the AI Developers. It’s so great to meet you “Unsung Heroes” on this Platform ChatGPT. My sincere thanks to ChatGPT for making our lives better. I’m very new to this Forum and AI models. Please, help me.
My objective is to Create a Male, Telugu speaking Voice or Audio Template. So that, whatever the Telugu Scripted text file or String, if I give as Input, the voice should convert to audio file. In case any emotions like "Friendly’, “Expressive”, that would be greatly helpful. I have tried with pyttsx3 where it does not contain male voice or emotions. either with TTS or pyttsx3 , if someone help me to start a bit, then I can start my AI Journey.
Here is the Code below…
import time
from tqdm import tqdm
from gradio_client import Client
import requests
Define the client
client = Client(“prtotocol:127.0.0.1:7860”)
Function to track progress
def download_audio(output):
# If the output is a file (binary data), save it
if isinstance(output, bytes):
with open(“output_audio.wav”, “wb”) as f:
f.write(output)
# If the output is a URL, download the file from the URL
elif isinstance(output, str) and output.startswith(“protocol”):
audio_url = output
response = requests.get(audio_url)
with open(“output_audio.wav”, “wb”) as f:
f.write(response.content)
Start timing the process
start_time = time.time()
Adding a progress bar for the process (e.g., 3 steps - request, processing, saving)
steps = 3 # You can adjust the number of steps to suit your actual process
with tqdm(total=steps, desc=“Processing”, ncols=100) as pbar:
# Call the API and get the output
pbar.set_postfix({“Step”: “API request”})
output = client.predict(
ref_audio_input=“Path\Recording.m4a”,
ref_text_input=“”,
gen_text_input=“హాయ్ ఫ్రెండ్స్. మీరంతా ఎలా ఉన్నారు? “,
remove_silence=False,
cross_fade_duration_slider=0.15,
speed_slider=1,
api_name=”/basic_tts”
)
pbar.update(1) # Update progress bar after API call
# Simulate processing the response (e.g., audio generation or other steps)
pbar.set_postfix({"Step": "Processing response"})
time.sleep(2) # Simulating some processing time (adjust as needed)
pbar.update(1) # Update progress bar after processing step
# Download the audio file
pbar.set_postfix({"Step": "Saving output"})
download_audio(output) # Function to handle file download
pbar.update(1) # Update progress bar after saving the file
End timing the process
end_time = time.time()
elapsed_time = end_time - start_time
Print the total elapsed time
print(f"Process completed in {elapsed_time:.2f} seconds.")
Regards
Kalyan Dev