Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
-
!pip install
|
|
|
|
| 2 |
import streamlit as st
|
|
|
|
|
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
# Load the model pipeline
|
|
@@ -31,11 +34,16 @@ def classify_audio(audio_input):
|
|
| 31 |
# Streamlit app
|
| 32 |
def main():
|
| 33 |
st.title("Stutter Classification App")
|
| 34 |
-
st.audio("
|
| 35 |
-
if st.button("
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
if __name__ == "__main__":
|
| 41 |
main()
|
|
|
|
| 1 |
+
!pip install -U transformers sounddevice
|
| 2 |
+
|
| 3 |
import streamlit as st
|
| 4 |
+
import sounddevice as sd
|
| 5 |
+
import soundfile as sf
|
| 6 |
from transformers import pipeline
|
| 7 |
|
| 8 |
# Load the model pipeline
|
|
|
|
| 34 |
# Streamlit app
|
| 35 |
def main():
|
| 36 |
st.title("Stutter Classification App")
|
| 37 |
+
audio_input = st.audio("Capture Audio", format="audio/wav", start_recording=True, channels=1)
|
| 38 |
+
if st.button("Stop Recording"):
|
| 39 |
+
sd.stop()
|
| 40 |
+
with st.spinner("Classifying..."):
|
| 41 |
+
# Read the recorded audio file
|
| 42 |
+
recording_path = "recording.wav"
|
| 43 |
+
audio_data, sampling_rate = sf.read(recording_path)
|
| 44 |
+
# Classify the audio
|
| 45 |
+
stutter_type = classify_audio(audio_data)
|
| 46 |
+
st.write("Predicted Stutter Type:", stutter_type)
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
main()
|