skriller18 commited on
Commit
c39573e
ยท
1 Parent(s): 7c4c876
Files changed (1) hide show
  1. app.py +24 -16
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
- speaker_id = st.selectbox("Select a speaker:", options=list(speakers.keys()), format_func=lambda x: speakers[x])
 
 
 
36
 
37
- text_input = st.text_area("Enter text for TTS (max 200 characters):", max_chars=200)
 
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)