Spaces:
Sleeping
Sleeping
File size: 1,140 Bytes
0e6eb34 |
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 |
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()
|