Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,6 +69,7 @@ def processFile(filePath):
|
|
| 69 |
annotations = pipeline({"waveform": waveformEnhanced, "sample_rate": sampleRate})
|
| 70 |
print("Speakers Detected")
|
| 71 |
speakerList = su.annotationToSpeakerList(annotations)
|
|
|
|
| 72 |
return (speakerList, annotations, int(waveformEnhanced.shape[-1]/sampleRate))
|
| 73 |
|
| 74 |
def addCategory():
|
|
@@ -121,8 +122,10 @@ def updateMultiSelect():
|
|
| 121 |
|
| 122 |
def analyze(inFileName):
|
| 123 |
try:
|
|
|
|
| 124 |
st.session_state.resetResult = False
|
| 125 |
currFileIndex = file_names.index(inFileName)
|
|
|
|
| 126 |
if len(st.session_state.results) > currFileIndex and len(st.session_state.summaries) > currFileIndex and len(st.session_state.results[currFileIndex]) > 0:
|
| 127 |
# Handle
|
| 128 |
currSpeakerList, currAnnotation, currTotalTime = st.session_state.results[currFileIndex]
|
|
@@ -225,7 +228,8 @@ def analyze(inFileName):
|
|
| 225 |
}
|
| 226 |
df2 = pd.DataFrame(df2_dict)
|
| 227 |
st.session_state.summaries[currFileIndex]["df2"] = df2
|
| 228 |
-
except ValueError:
|
|
|
|
| 229 |
pass
|
| 230 |
|
| 231 |
#----------------------------------------------------------------------------------------------------------------------
|
|
@@ -380,11 +384,14 @@ else:
|
|
| 380 |
#st.info(file_paths[i])
|
| 381 |
with st.spinner(text=f'Processing File {i+1} of {totalFiles}'):
|
| 382 |
speakerList, annotations, totalSeconds = processFile(file_paths[i])
|
|
|
|
| 383 |
st.session_state.results[i] = (speakerList,annotations, totalSeconds)
|
|
|
|
| 384 |
st.session_state.summaries[i] = {}
|
|
|
|
| 385 |
speakerNames = annotations.labels()
|
| 386 |
st.session_state.unusedSpeakers[i] = speakerNames
|
| 387 |
-
print(
|
| 388 |
with st.spinner(text=f'Analyzing File {i+1} of {totalFiles}'):
|
| 389 |
analyze(file_names[i])
|
| 390 |
print(f"Finished analyzing {file_paths[i]}")
|
|
|
|
| 69 |
annotations = pipeline({"waveform": waveformEnhanced, "sample_rate": sampleRate})
|
| 70 |
print("Speakers Detected")
|
| 71 |
speakerList = su.annotationToSpeakerList(annotations)
|
| 72 |
+
print("Speakers split into list")
|
| 73 |
return (speakerList, annotations, int(waveformEnhanced.shape[-1]/sampleRate))
|
| 74 |
|
| 75 |
def addCategory():
|
|
|
|
| 122 |
|
| 123 |
def analyze(inFileName):
|
| 124 |
try:
|
| 125 |
+
print(f"Start analyzing {inFileName}")
|
| 126 |
st.session_state.resetResult = False
|
| 127 |
currFileIndex = file_names.index(inFileName)
|
| 128 |
+
print(f"Found at index {currFileIndex}")
|
| 129 |
if len(st.session_state.results) > currFileIndex and len(st.session_state.summaries) > currFileIndex and len(st.session_state.results[currFileIndex]) > 0:
|
| 130 |
# Handle
|
| 131 |
currSpeakerList, currAnnotation, currTotalTime = st.session_state.results[currFileIndex]
|
|
|
|
| 228 |
}
|
| 229 |
df2 = pd.DataFrame(df2_dict)
|
| 230 |
st.session_state.summaries[currFileIndex]["df2"] = df2
|
| 231 |
+
except ValueError as e:
|
| 232 |
+
print(f"Value Error: {e}")
|
| 233 |
pass
|
| 234 |
|
| 235 |
#----------------------------------------------------------------------------------------------------------------------
|
|
|
|
| 384 |
#st.info(file_paths[i])
|
| 385 |
with st.spinner(text=f'Processing File {i+1} of {totalFiles}'):
|
| 386 |
speakerList, annotations, totalSeconds = processFile(file_paths[i])
|
| 387 |
+
print(f"Finished processing {file_paths[i]}")
|
| 388 |
st.session_state.results[i] = (speakerList,annotations, totalSeconds)
|
| 389 |
+
print("Results saved")
|
| 390 |
st.session_state.summaries[i] = {}
|
| 391 |
+
print("Summaries saved")
|
| 392 |
speakerNames = annotations.labels()
|
| 393 |
st.session_state.unusedSpeakers[i] = speakerNames
|
| 394 |
+
print("Speakers saved")
|
| 395 |
with st.spinner(text=f'Analyzing File {i+1} of {totalFiles}'):
|
| 396 |
analyze(file_names[i])
|
| 397 |
print(f"Finished analyzing {file_paths[i]}")
|