Update app.py
Browse files
app.py
CHANGED
|
@@ -88,6 +88,12 @@ def transcribe_audio(audio_file):
|
|
| 88 |
audio_input = audio_input.astype(np.float32)
|
| 89 |
print(f"Audio duration: {len(audio_input) / sr:.2f} seconds")
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
chunk_length = 30 * sr
|
| 92 |
overlap = 5 * sr
|
| 93 |
transcriptions = []
|
|
@@ -177,7 +183,9 @@ def pdf_compressor():
|
|
| 177 |
if transcript:
|
| 178 |
put_text(transcript)
|
| 179 |
download_link = download_transcript(transcript)
|
| 180 |
-
|
|
|
|
|
|
|
| 181 |
else:
|
| 182 |
put_text("Failed to transcribe video.")
|
| 183 |
|
|
|
|
| 88 |
audio_input = audio_input.astype(np.float32)
|
| 89 |
print(f"Audio duration: {len(audio_input) / sr:.2f} seconds")
|
| 90 |
|
| 91 |
+
# Apply speaker diarization
|
| 92 |
+
if pipeline:
|
| 93 |
+
print("Applying speaker diarization...")
|
| 94 |
+
diarization = pipeline(audio_file)
|
| 95 |
+
print("Speaker diarization complete.")
|
| 96 |
+
|
| 97 |
chunk_length = 30 * sr
|
| 98 |
overlap = 5 * sr
|
| 99 |
transcriptions = []
|
|
|
|
| 183 |
if transcript:
|
| 184 |
put_text(transcript)
|
| 185 |
download_link = download_transcript(transcript)
|
| 186 |
+
with open(download_link, 'r') as file:
|
| 187 |
+
file_content = file.read()
|
| 188 |
+
put_file(content=file_content, label="Download Transcript")
|
| 189 |
else:
|
| 190 |
put_text("Failed to transcribe video.")
|
| 191 |
|