Update src/streamlit_app.py
Browse files- src/streamlit_app.py +25 -14
src/streamlit_app.py
CHANGED
|
@@ -1,27 +1,38 @@
|
|
| 1 |
-
import altair as alt
|
| 2 |
-
import numpy as np
|
| 3 |
-
import pandas as pd
|
| 4 |
import streamlit as st
|
| 5 |
-
|
| 6 |
import whisper
|
|
|
|
| 7 |
|
| 8 |
st.set_page_config(
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
)
|
| 13 |
|
| 14 |
-
st.markdown(
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
activity = ['Select your Language', 'English']
|
| 17 |
choice = st.selectbox('How you want to proceed?', activity)
|
| 18 |
|
| 19 |
if choice == 'English':
|
| 20 |
-
uploaded_file = st.file_uploader(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
if uploaded_file is not None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
model = whisper.load_model("turbo")
|
| 23 |
-
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import whisper
|
| 3 |
+
import tempfile
|
| 4 |
|
| 5 |
st.set_page_config(
|
| 6 |
+
page_title="IndicASR",
|
| 7 |
+
page_icon="✔️",
|
| 8 |
+
layout="wide",
|
| 9 |
)
|
| 10 |
|
| 11 |
+
st.markdown(
|
| 12 |
+
'''<h1><center><b><u>IndicASR</u></b></center></h1>''',
|
| 13 |
+
unsafe_allow_html=True
|
| 14 |
+
)
|
| 15 |
|
| 16 |
activity = ['Select your Language', 'English']
|
| 17 |
choice = st.selectbox('How you want to proceed?', activity)
|
| 18 |
|
| 19 |
if choice == 'English':
|
| 20 |
+
uploaded_file = st.file_uploader(
|
| 21 |
+
"Upload your Audio File",
|
| 22 |
+
type=["mp3", "wav", "m4a"]
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
if uploaded_file is not None:
|
| 26 |
+
# Save uploaded file to a temp location
|
| 27 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
| 28 |
+
tmp_file.write(uploaded_file.read())
|
| 29 |
+
audio_path = tmp_file.name
|
| 30 |
+
|
| 31 |
+
# Load Whisper model
|
| 32 |
model = whisper.load_model("turbo")
|
| 33 |
+
|
| 34 |
+
# Transcribe
|
| 35 |
+
result = model.transcribe(audio_path, verbose=False)
|
| 36 |
+
|
| 37 |
+
st.subheader("Transcript")
|
| 38 |
+
st.write(result["text"])
|