Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,7 @@ initialize_session_state()
|
|
| 29 |
if "transcription" not in st.session_state or not st.session_state.transcription:
|
| 30 |
st.session_state.whisper = load_whisper()
|
| 31 |
|
| 32 |
-
|
| 33 |
-
display_memory_once()
|
| 34 |
|
| 35 |
# Reset state for a new analysis
|
| 36 |
if st.button("Analyze new video"):
|
|
@@ -72,8 +71,7 @@ if st.session_state.audio_path and not st.session_state.transcription:
|
|
| 72 |
st.session_state.audio_ready = True
|
| 73 |
st.audio(st.session_state.audio_path, format='audio/wav')
|
| 74 |
time.sleep(5)
|
| 75 |
-
|
| 76 |
-
st.write(f"Memory used: {mem.percent}%")
|
| 77 |
#Detect Language AND FILTER OUT NON-ENGLISH AUDIOS FOR ANALYSIS
|
| 78 |
segments, info = st.session_state.whisper.transcribe(st.session_state.audio_path, beam_size=1)
|
| 79 |
|
|
@@ -93,8 +91,6 @@ if st.session_state.audio_path and not st.session_state.transcription:
|
|
| 93 |
|
| 94 |
if 'classifier' not in st.session_state:
|
| 95 |
st.session_state.classifier = load_accent_model()
|
| 96 |
-
mem = psutil.virtual_memory()
|
| 97 |
-
st.write(f"Memory used: {mem.percent}%")
|
| 98 |
time.sleep(5)
|
| 99 |
|
| 100 |
|
|
@@ -102,8 +98,7 @@ if st.session_state.transcription:
|
|
| 102 |
if st.button("Analyze Accent"):
|
| 103 |
with st.spinner("Analyzing accent..."):
|
| 104 |
try:
|
| 105 |
-
|
| 106 |
-
st.write(f"Memory used: {mem.percent}%")
|
| 107 |
waveform, sample_rate = torchaudio.load(st.session_state.audio_path)
|
| 108 |
readable_accent, confidence = analyze_accent(waveform, sample_rate, st.session_state.classifier)
|
| 109 |
|
|
|
|
| 29 |
if "transcription" not in st.session_state or not st.session_state.transcription:
|
| 30 |
st.session_state.whisper = load_whisper()
|
| 31 |
|
| 32 |
+
|
|
|
|
| 33 |
|
| 34 |
# Reset state for a new analysis
|
| 35 |
if st.button("Analyze new video"):
|
|
|
|
| 71 |
st.session_state.audio_ready = True
|
| 72 |
st.audio(st.session_state.audio_path, format='audio/wav')
|
| 73 |
time.sleep(5)
|
| 74 |
+
|
|
|
|
| 75 |
#Detect Language AND FILTER OUT NON-ENGLISH AUDIOS FOR ANALYSIS
|
| 76 |
segments, info = st.session_state.whisper.transcribe(st.session_state.audio_path, beam_size=1)
|
| 77 |
|
|
|
|
| 91 |
|
| 92 |
if 'classifier' not in st.session_state:
|
| 93 |
st.session_state.classifier = load_accent_model()
|
|
|
|
|
|
|
| 94 |
time.sleep(5)
|
| 95 |
|
| 96 |
|
|
|
|
| 98 |
if st.button("Analyze Accent"):
|
| 99 |
with st.spinner("Analyzing accent..."):
|
| 100 |
try:
|
| 101 |
+
|
|
|
|
| 102 |
waveform, sample_rate = torchaudio.load(st.session_state.audio_path)
|
| 103 |
readable_accent, confidence = analyze_accent(waveform, sample_rate, st.session_state.classifier)
|
| 104 |
|