-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add audio data input
- Loading branch information
Showing
9 changed files
with
147 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,7 @@ cython_debug/ | |
# PyPI configuration file | ||
.pypirc | ||
|
||
audio/ | ||
images/ | ||
vectorstore/ | ||
trial.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
import requests | ||
import streamlit as st | ||
import sys | ||
import whisper | ||
|
||
from vectordb import add_image_to_index, add_pdf_to_index, add_audio_to_index | ||
|
||
sys.path.append(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
def upload_audio(whisper_model, text_embedding_model): | ||
st.title("Upload Audio") | ||
recorded_audio = st.audio_input("Record Audio") | ||
st.write("---") | ||
uploaded_audios = st.file_uploader("Upload Audio", type=["mp3", "wav"], accept_multiple_files=True) | ||
if recorded_audio: | ||
st.audio(recorded_audio) | ||
if st.button("Add Audio"): | ||
add_audio_to_index(recorded_audio, whisper_model, text_embedding_model) | ||
st.success("Audio Added to Database") | ||
if uploaded_audios: | ||
for audio in uploaded_audios: | ||
st.audio(audio) | ||
if st.button("Add Audio"): | ||
progress_bar = st.progress(0, f"Adding Audio... | 0/{len(uploaded_audios)}") | ||
for count, audio in enumerate(uploaded_audios): | ||
add_audio_to_index(audio, whisper_model, text_embedding_model) | ||
progress_bar.progress((count + 1) / len(uploaded_audios), f"Adding Audio... | {count + 1}/{len(uploaded_audios)}") | ||
st.success("Audio Added to Database") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.