Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Added CSV support
Browse files
app.py
CHANGED
|
@@ -344,7 +344,7 @@ if not isGPU:
|
|
| 344 |
|
| 345 |
uploaded_file_paths = st.file_uploader("Upload an audio of classroom activity to analyze", accept_multiple_files=True)
|
| 346 |
|
| 347 |
-
supported_file_types = ('.wav','.mp3','.mp4','.txt','.rttm')
|
| 348 |
viewChoices = ["Voice Categories","Custom Categories","Detailed Voice Categories","Voice Category Treemap","Speaker Timeline","Time per Speaker"]
|
| 349 |
|
| 350 |
valid_files = []
|
|
@@ -407,7 +407,7 @@ else:
|
|
| 407 |
with st.spinner(text=f'Loading Demo File {i+1} of {totalFiles}'):
|
| 408 |
# RTTM load as filler
|
| 409 |
speakerList, annotations = su.loadAudioTXT(file_paths[i])
|
| 410 |
-
|
| 411 |
# Approximate total seconds
|
| 412 |
totalSeconds = 0
|
| 413 |
for segment in annotations.itersegments():
|
|
@@ -421,7 +421,21 @@ else:
|
|
| 421 |
with st.spinner(text=f'Loading File {i+1} of {totalFiles}'):
|
| 422 |
# RTTM load as filler
|
| 423 |
speakerList, annotations = su.loadAudioRTTM(file_paths[i])
|
| 424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
# Approximate total seconds
|
| 426 |
totalSeconds = 0
|
| 427 |
for segment in annotations.itersegments():
|
|
@@ -948,11 +962,16 @@ with st.expander("Instructions and additional details"):
|
|
| 948 |
st.write("2. Press Analyze All. Note that no data is saved on our side, so we will not have access to your recordings. Future versions of this app will support donating audio to us for aid in our research.")
|
| 949 |
st.write("3. Use the side bar on the left to select your file (may have to be expanded by clicking the > ). Our app supports uploading multiple files for more comprehensive analysis.")
|
| 950 |
st.write("4. Use the tabs provided to view different visualizations of your audio. Each example can be downloaded for personal use.")
|
| 951 |
-
st.write("
|
| 952 |
|
| 953 |
with st.expander("(Potentially) FAQ"):
|
| 954 |
-
st.write(f"**I tried analyzing a file, but the page refreshed and nothing happened! Why?**\n\
|
| 955 |
-
st.write(
|
| 956 |
-
st.write(f"**I
|
| 957 |
-
st.write(
|
| 958 |
-
st.write(f"**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
|
| 345 |
uploaded_file_paths = st.file_uploader("Upload an audio of classroom activity to analyze", accept_multiple_files=True)
|
| 346 |
|
| 347 |
+
supported_file_types = ('.wav','.mp3','.mp4','.txt','.rttm','.csv')
|
| 348 |
viewChoices = ["Voice Categories","Custom Categories","Detailed Voice Categories","Voice Category Treemap","Speaker Timeline","Time per Speaker"]
|
| 349 |
|
| 350 |
valid_files = []
|
|
|
|
| 407 |
with st.spinner(text=f'Loading Demo File {i+1} of {totalFiles}'):
|
| 408 |
# RTTM load as filler
|
| 409 |
speakerList, annotations = su.loadAudioTXT(file_paths[i])
|
| 410 |
+
printV(annotations,4)
|
| 411 |
# Approximate total seconds
|
| 412 |
totalSeconds = 0
|
| 413 |
for segment in annotations.itersegments():
|
|
|
|
| 421 |
with st.spinner(text=f'Loading File {i+1} of {totalFiles}'):
|
| 422 |
# RTTM load as filler
|
| 423 |
speakerList, annotations = su.loadAudioRTTM(file_paths[i])
|
| 424 |
+
printV(annotations,4)
|
| 425 |
+
# Approximate total seconds
|
| 426 |
+
totalSeconds = 0
|
| 427 |
+
for segment in annotations.itersegments():
|
| 428 |
+
if segment.end > totalSeconds:
|
| 429 |
+
totalSeconds = segment.end
|
| 430 |
+
st.session_state.results[i] = (annotations, totalSeconds)
|
| 431 |
+
st.session_state.summaries[i] = {}
|
| 432 |
+
speakerNames = annotations.labels()
|
| 433 |
+
st.session_state.unusedSpeakers[i] = speakerNames
|
| 434 |
+
elif file_paths[i].lower().endswith('.csv'):
|
| 435 |
+
with st.spinner(text=f'Loading File {i+1} of {totalFiles}'):
|
| 436 |
+
# RTTM load as filler
|
| 437 |
+
speakerList, annotations = su.loadAudioCSV(file_paths[i])
|
| 438 |
+
printV(annotations,4)
|
| 439 |
# Approximate total seconds
|
| 440 |
totalSeconds = 0
|
| 441 |
for segment in annotations.itersegments():
|
|
|
|
| 962 |
st.write("2. Press Analyze All. Note that no data is saved on our side, so we will not have access to your recordings. Future versions of this app will support donating audio to us for aid in our research.")
|
| 963 |
st.write("3. Use the side bar on the left to select your file (may have to be expanded by clicking the > ). Our app supports uploading multiple files for more comprehensive analysis.")
|
| 964 |
st.write("4. Use the tabs provided to view different visualizations of your audio. Each example can be downloaded for personal use.")
|
| 965 |
+
st.write("4a. The graphs are built using [plotly](https://plotly.com/). This allows for a high degree of interaction. Feel free to experiment with the graphs, as you can always return to the original view by double-clicking on the graph. For more examples of easily supported visualizations, see [here](https://plotly.com/python/basic-charts/)")
|
| 966 |
|
| 967 |
with st.expander("(Potentially) FAQ"):
|
| 968 |
+
st.write(f"**1. I tried analyzing a file, but the page refreshed and nothing happened! Why?**\n\t")
|
| 969 |
+
st.write("You may need to select a file using the side bar on the left. This app supports multiple files, so we require that you select which file to view after analysis.")
|
| 970 |
+
st.write(f"**2. I don't see a sidebar! Where is it?**\n\t")
|
| 971 |
+
st.write("The side bar may start by being minimized. Press the '>' in the upper left to expand the side bar.")
|
| 972 |
+
st.write(f"**3. I still don't have a file to select in the dropdown! Why?**\n\t")
|
| 973 |
+
st.write("If you are sure that you have run Analyze All and after refresh no files may be selected, then your file is likely too large. We currently have a limitation of approximately 1.5 hours of audio. This is a known issue that requires additional time **or** money to solve, and is expected to be fixed by the next update of this app. Please be patient!")
|
| 974 |
+
st.write(f"**4. I want to be able to view my previously analyzed data! How can I do this?**\n\t")
|
| 975 |
+
st.write("You can download a CSV copy of the data using the first tab. From there, you can reupload the CSV copy at a later date to view the data visualizations without having to use your original audio file. Future versions of this app will support creating optional logins for long term storage and analysis.")
|
| 976 |
+
st.write(f"**5. The app says 'TOOL CURRENTLY USING CPU, ANALYSIS EXTREMELY SLOW' and takes forever to analyze audio! What is wrong?**\n\t")
|
| 977 |
+
st.write("We are currently in the process of securing funding to allow permanent public access to this tool. Until then, we can provide an interface to view already analyzed data without cost to you or us. While this mode will technically still work, it may take over a day to analyze your audio. Feel free to reach out to us to discuss temporary solutions to this until the app's funding is secured!")
|