Documentation
developer docs
pip install streamlit spitch
import streamlit as st from spitch import Spitch import os import tempfile
def transcribe_audio(audio_file, lang): os.environ["SPITCH_API_KEY"] = "YOUR-API-KEY" client = Spitch() with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as temp_file: temp_file.write(audio_file.read()) temp_path = temp_file.name with open(temp_path, "rb") as f: response = client.speech.transcribe(language=lang, content=f.read()) return response.text
def main(): st.title("My Spitch Transcription App") st.write("Upload an audio file to transcribe it to text.") audio_file = st.file_uploader("Upload Audio", type=["wav", "mp3"]) if audio_file: st.audio(audio_file, format='audio/wav') language = st.selectbox("Language", ["English", "Yoruba", "Igbo", "Hausa"]) lang = {'English': 'en', 'Yoruba': 'yo', 'Igbo': 'ig'}.get(language, 'ha') if st.button("Transcribe"): with st.spinner("Transcribing..."): transcript = transcribe_audio(audio_file, lang) st.success("Transcription completed!") st.text_area("Transcript", transcript, height=200) st.download_button("Download Transcript", data=transcript, file_name="transcript.txt") if __name__ == "__main__": main()
$ git clone https://github.com/Nalito/My-Spitch-Transcription-App.git $ cd My-Spitch-Transcription-App
streamlit run app.py
Was this page helpful?