Spaces:
Sleeping
Sleeping
skriller18
commited on
Commit
ยท
c39573e
1
Parent(s):
7c4c876
Changes
Browse files
app.py
CHANGED
@@ -16,27 +16,35 @@ pipe = pipeline(
|
|
16 |
st.title("Indri")
|
17 |
st.subheader("Ultrafast multi-modal AI")
|
18 |
|
|
|
|
|
|
|
|
|
19 |
speakers = {
|
20 |
-
"[spkr_63] : ๐ฌ๐ง ๐จ book reader",
|
21 |
-
"[spkr_67] : ๐บ๐ธ ๐จ influencer",
|
22 |
-
"[spkr_68] : ๐ฎ๐ณ ๐จ book reader",
|
23 |
-
"[spkr_69] : ๐ฎ๐ณ ๐จ book reader",
|
24 |
-
"[spkr_70] : ๐ฎ๐ณ ๐จ motivational speaker",
|
25 |
-
"[spkr_62] : ๐ฎ๐ณ ๐จ book reader heavy",
|
26 |
-
"[spkr_53] : ๐ฎ๐ณ ๐ฉ recipe reciter",
|
27 |
-
"[spkr_60] : ๐ฎ๐ณ ๐ฉ book reader",
|
28 |
-
"[spkr_74] : ๐บ๐ธ ๐จ book reader",
|
29 |
-
"[spkr_75] : ๐ฎ๐ณ ๐จ entrepreneur",
|
30 |
-
"[spkr_76] : ๐ฌ๐ง ๐จ nature lover",
|
31 |
-
"[spkr_77] : ๐ฎ๐ณ ๐จ influencer",
|
32 |
-
"[spkr_66] : ๐ฎ๐ณ ๐จ politician"
|
33 |
}
|
34 |
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
-
|
|
|
38 |
|
39 |
-
if st.button("Generate Audio"):
|
40 |
if text_input:
|
41 |
output = pipe([text_input], speaker=speaker_id)
|
42 |
torchaudio.save('output.wav', output[0]['audio'][0], sample_rate=24000)
|
|
|
16 |
st.title("Indri")
|
17 |
st.subheader("Ultrafast multi-modal AI")
|
18 |
|
19 |
+
# Add some spacing and a description
|
20 |
+
st.markdown("<h3 style='text-align: center;'>Text-to-Speech Application</h3>", unsafe_allow_html=True)
|
21 |
+
st.markdown("<p style='text-align: center;'>Select a speaker and enter text to generate audio.</p>", unsafe_allow_html=True)
|
22 |
+
|
23 |
speakers = {
|
24 |
+
"[spkr_63]" : "๐ฌ๐ง ๐จ book reader",
|
25 |
+
"[spkr_67]" : "๐บ๐ธ ๐จ influencer",
|
26 |
+
"[spkr_68]" : "๐ฎ๐ณ ๐จ book reader",
|
27 |
+
"[spkr_69]" : "๐ฎ๐ณ ๐จ book reader",
|
28 |
+
"[spkr_70]" : "๐ฎ๐ณ ๐จ motivational speaker",
|
29 |
+
"[spkr_62]" : "๐ฎ๐ณ ๐จ book reader heavy",
|
30 |
+
"[spkr_53]" : "๐ฎ๐ณ ๐ฉ recipe reciter",
|
31 |
+
"[spkr_60]" : "๐ฎ๐ณ ๐ฉ book reader",
|
32 |
+
"[spkr_74]" : "๐บ๐ธ ๐จ book reader",
|
33 |
+
"[spkr_75]" : "๐ฎ๐ณ ๐จ entrepreneur",
|
34 |
+
"[spkr_76]" : "๐ฌ๐ง ๐จ nature lover",
|
35 |
+
"[spkr_77]" : "๐ฎ๐ณ ๐จ influencer",
|
36 |
+
"[spkr_66]" : "๐ฎ๐ณ ๐จ politician"
|
37 |
}
|
38 |
|
39 |
+
# Create a container for the speaker selection and text input
|
40 |
+
with st.container():
|
41 |
+
st.markdown("### Speaker Selection")
|
42 |
+
speaker_id = st.selectbox("Select a speaker:", options=list(speakers.keys()), format_func=lambda x: speakers[x])
|
43 |
|
44 |
+
st.markdown("### Text Input")
|
45 |
+
text_input = st.text_area("Enter text for TTS (max 200 characters):", max_chars=200)
|
46 |
|
47 |
+
if st.button("Generate Audio", key="generate_audio"):
|
48 |
if text_input:
|
49 |
output = pipe([text_input], speaker=speaker_id)
|
50 |
torchaudio.save('output.wav', output[0]['audio'][0], sample_rate=24000)
|