import streamlit as st from utils import * import io # Customizing the appearance st.markdown( """ """, 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("
", unsafe_allow_html=True) if __name__ == '__main__': main()