File size: 679 Bytes
5df35e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import streamlit as st
import requests 
import base64

st.title("Text to Speech App -  powered by Gradio, hosted on 🤗")
inp_text = st.text_input("Input text here to convert to speech")

button = st.button("⌨️Text to speech magic 🗣️")

if button:
    with st.spinner():

        response_json = requests.post("https://abidlabs-speak.hf.space/run/predict",json={
        "data": [
            inp_text,
        ]}).json()
        
        md = f"""
            <audio controls>
            <source src="{response_json['data'][0]}" type="audio/flac">
            </audio>
            """
        st.markdown(
            md,
            unsafe_allow_html=True,
        )