Spaces:
Runtime error
Runtime error
Aray Karjauv
commited on
Commit
•
9a5fefb
1
Parent(s):
cb38808
- app.py +6 -1
- backend.py +2 -5
- requirements.txt +1 -2
app.py
CHANGED
@@ -43,7 +43,12 @@ def run():
|
|
43 |
duration = split_audio(tmpdirname, uploaded_fp)
|
44 |
|
45 |
placeholder.write("Removing noise...")
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
47 |
progress_bar.progress(50)
|
48 |
|
49 |
# https://docs.streamlit.io/knowledge-base/using-streamlit/where-file-uploader-store-when-deleted
|
|
|
43 |
duration = split_audio(tmpdirname, uploaded_fp)
|
44 |
|
45 |
placeholder.write("Removing noise...")
|
46 |
+
|
47 |
+
use_auth_token = True
|
48 |
+
if st.secrets.get("ACCESS_TOKEN"):
|
49 |
+
use_auth_token = st.secrets["ACCESS_TOKEN"]
|
50 |
+
|
51 |
+
get_speakers(tmpdirname, use_auth_token)
|
52 |
progress_bar.progress(50)
|
53 |
|
54 |
# https://docs.streamlit.io/knowledge-base/using-streamlit/where-file-uploader-store-when-deleted
|
backend.py
CHANGED
@@ -81,7 +81,7 @@ def split_audio(tmpdirname, video, chunk_size=120):
|
|
81 |
return audio.duration
|
82 |
|
83 |
|
84 |
-
def get_speakers(tmpdirname):
|
85 |
files = find_audio_files(opj(tmpdirname, 'noisy_chunks'))
|
86 |
dset = Audioset(files, with_path=True,
|
87 |
sample_rate=denoise_model.sample_rate, channels=denoise_model.chin, convert=True)
|
@@ -111,10 +111,7 @@ def get_speakers(tmpdirname):
|
|
111 |
final_clip.write_audiofile(cleaned_path)
|
112 |
print('identifying speakers...')
|
113 |
|
114 |
-
|
115 |
-
pipeline = Pipeline.from_pretrained('pyannote/speaker-diarization', use_auth_token=st.secrets["ACCESS_TOKEN"])
|
116 |
-
else:
|
117 |
-
pipeline = Pipeline.from_pretrained('pyannote/speaker-diarization', use_auth_token=True)
|
118 |
|
119 |
return str(pipeline({'uri': '', 'audio': cleaned_path})).split('\n'), cleaned_path
|
120 |
|
|
|
81 |
return audio.duration
|
82 |
|
83 |
|
84 |
+
def get_speakers(tmpdirname, use_auth_token=True):
|
85 |
files = find_audio_files(opj(tmpdirname, 'noisy_chunks'))
|
86 |
dset = Audioset(files, with_path=True,
|
87 |
sample_rate=denoise_model.sample_rate, channels=denoise_model.chin, convert=True)
|
|
|
111 |
final_clip.write_audiofile(cleaned_path)
|
112 |
print('identifying speakers...')
|
113 |
|
114 |
+
pipeline = Pipeline.from_pretrained('pyannote/speaker-diarization', use_auth_token=use_auth_token)
|
|
|
|
|
|
|
115 |
|
116 |
return str(pipeline({'uri': '', 'audio': cleaned_path})).split('\n'), cleaned_path
|
117 |
|
requirements.txt
CHANGED
@@ -2,5 +2,4 @@ pyannote.audio==2.1.1
|
|
2 |
denoiser==0.1.5
|
3 |
moviepy==1.0.3
|
4 |
pydub==0.25.1
|
5 |
-
git+https://github.com/openai/whisper.git
|
6 |
-
# omegaconf
|
|
|
2 |
denoiser==0.1.5
|
3 |
moviepy==1.0.3
|
4 |
pydub==0.25.1
|
5 |
+
git+https://github.com/openai/whisper.git
|
|