Spaces:
Running
Running
skriller18
commited on
Commit
β’
321fb0f
1
Parent(s):
f13bfac
Created app file
Browse files
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: π
|
4 |
colorFrom: red
|
5 |
colorTo: indigo
|
|
|
1 |
---
|
2 |
+
title: IndriVoice
|
3 |
emoji: π
|
4 |
colorFrom: red
|
5 |
colorTo: indigo
|
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torchaudio
|
3 |
+
from transformers import pipeline
|
4 |
+
import streamlit as st
|
5 |
+
|
6 |
+
x = st.slider('Select a value')
|
7 |
+
st.write(x, 'squared is', x * x)
|
8 |
+
|
9 |
+
|
10 |
+
model_id = '11mlabs/indri-0.1-124m-tts'
|
11 |
+
task = 'indri-tts'
|
12 |
+
|
13 |
+
pipe = pipeline(
|
14 |
+
task,
|
15 |
+
model=model_id,
|
16 |
+
#device=torch.device('cuda:0'), # Update this based on your hardware,
|
17 |
+
trust_remote_code=True
|
18 |
+
)
|
19 |
+
|
20 |
+
text_input = st.text_area("Enter text for TTS (max 200 characters):", max_chars=200)
|
21 |
+
|
22 |
+
speaker_name = st.text_input("Enter speaker's name:")
|
23 |
+
|
24 |
+
if st.button("Generate Audio"):
|
25 |
+
if text_input:
|
26 |
+
output = pipe([text_input], speaker=speaker_name)
|
27 |
+
torchaudio.save('output.wav', output[0]['audio'][0], sample_rate=24000)
|
28 |
+
st.audio('output.wav') # Display audio blob output
|
29 |
+
else:
|
30 |
+
st.warning("Please enter text to generate audio.")
|