Spaces:
Runtime error
Runtime error
Download app.py from Pranav4datasc/Text2Speech: direct link, hf CLI and curl.
- Browser
- Download file 679 Bytes
-
https://huggingface.co/spaces/Pranav4datasc/Text2Speech/resolve/main/app.py
- Command line
-
hf download hf://spaces/Pranav4datasc/Text2Speech/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Pranav4datasc/Text2Speech/resolve/main/app.py
679 Bytes
| 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, | |
| ) |