Tramsformer / app.py
GuGai's picture
Update app.py
adac30c
raw
history blame
590 Bytes
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'].numpy(), rate=16000)
if __name__ == "__main__":
main()