Spaces:
Runtime error
Runtime error
File size: 1,756 Bytes
a75448e e158b59 a185578 f03ee58 e158b59 f03ee58 e158b59 a75448e 0d5bf49 a75448e a185578 a75448e f03ee58 6c5c329 a75448e 6c5c329 f03ee58 6c5c329 a75448e ca7c161 73262eb |
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
import streamlit as st
from utils import *
import io
# Customizing the appearance
st.markdown(
"""
<style>
.stApp {
background-color: #f8f9fa;
color: #333333;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.stRadio > div > div {
background-color: #006699 !important;
color: white !important;
}
.stButton>button {
background-color: #006699;
color: white;
font-size: 16px;
font-weight: bold;
border-radius: 5px;
padding: 10px 20px;
}
.footer {
background-color: #f0f2f6;
padding: 10px;
color: #666666;
font-size: 14px;
text-align: center;
}
</style>
""",
unsafe_allow_html=True
)
def main():
st.title("GenAI Speech-Text Transcriber")
mode = st.radio('Choose Mode', ('Speech to Text', 'Text to Speech'), key="mode_selection")
if mode == 'Text to Speech':
st.subheader('Convert Text to Speech')
input_text = st.text_area("Enter the text here")
if st.button("Generate Audio", key="generate_audio") and input_text:
response = text_to_speech(input_text)
if response:
st.audio(io.BytesIO(response.content), format='audio/mp3')
elif mode == 'Speech to Text':
st.subheader('Convert Speech to Text')
audio_uploaded = st.file_uploader("Upload your audio file", type=['mp3', 'wav'])
if st.button("Generate Transcript", key="generate_transcript") and audio_uploaded:
text = audio_to_text(audio_uploaded)
st.write(text)
st.markdown("<p class='footer'>Powered by GenAI</p>", unsafe_allow_html=True)
if __name__ == '__main__':
main() |