File size: 599 Bytes
9f7c784
adac30c
9f7c784
de400b6
9f7c784
62535e6
9f7c784
626e3c7
9f7c784
 
 
 
 
 
4cffab4
06ed46f
3c3f4a8
9f7c784
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import streamlit as st
import numpy
from transformers import pipeline
from IPython.display import Audio

classifier = pipeline("text-to-speech", model="GuGai/text_to_speech_G")
def main():
    st.title("Text to Speech")

    with st.form("text_field"):
        text = st.text_area('enter some text:')
        # clicked==True only when the button is clicked
        clicked = st.form_submit_button("Submit text")
        if clicked:
          results = classifier(text)
          st.json(results)
          Audio(results['audio'], rate=results['sampling_rate'])

if __name__ == "__main__":
    main()