Spaces:
Running
Running
import torch | |
import torchaudio | |
from transformers import pipeline | |
import streamlit as st | |
x = st.slider('Select a value') | |
st.write(x, 'squared is', x * x) | |
model_id = '11mlabs/indri-0.1-124m-tts' | |
task = 'indri-tts' | |
pipe = pipeline( | |
task, | |
model=model_id, | |
#device=torch.device('cuda:0'), # Update this based on your hardware, | |
trust_remote_code=True | |
) | |
text_input = st.text_area("Enter text for TTS (max 200 characters):", max_chars=200) | |
speaker_name = st.text_input("Enter speaker's name:") | |
if st.button("Generate Audio"): | |
if text_input: | |
output = pipe([text_input], speaker=speaker_name) | |
torchaudio.save('output.wav', output[0]['audio'][0], sample_rate=24000) | |
st.audio('output.wav') # Display audio blob output | |
else: | |
st.warning("Please enter text to generate audio.") | |