dmedhi's picture
add app and dependencies
0e6eb34
raw
history blame
1.14 kB
import streamlit as st
from whisper import transcribe_audio
def transcribe(audio_file):
return transcribe_audio(audio_file)
def main():
st.set_page_config(page_title="Transcriber", page_icon="πŸ’¬", layout="wide")
st.markdown(
"""<h1 align="center";>Transcriber</h1>""",
unsafe_allow_html=True,
)
cols = st.columns(2)
with cols[0]:
with st.container(border=True, height=300):
audio_file = st.file_uploader(
label="Upload your audio",
type=["wav", "mp3"],
key="audio_file_uploader",
)
if audio_file:
st.audio(audio_file)
sub_btn = st.button("Run", key="sub_btn")
with cols[1]:
with st.container(border=True, height=400):
if sub_btn and audio_file:
st.text_area(
label="Transcribed text",
value=transcribe(audio_file.read())["text"],
height=350,
)
else:
st.info("Upload audio file", icon="πŸ’‘")
if __name__ == "__main__":
main()