Create components/speech_restoration.py
Browse files
components/speech_restoration.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from utils.ai_functions import restore_speech
|
| 3 |
+
from utils.data_processing import process_audio_samples
|
| 4 |
+
|
| 5 |
+
def show_speech_restoration():
|
| 6 |
+
st.title("Speech Restoration")
|
| 7 |
+
st.write("Restore speech for those with impairments using neural networks and audio samples.")
|
| 8 |
+
|
| 9 |
+
samples = st.file_uploader("Upload audio samples (WAV files)", accept_multiple_files=True, type=['wav'])
|
| 10 |
+
|
| 11 |
+
if st.button("Restore Speech"):
|
| 12 |
+
if samples:
|
| 13 |
+
with st.spinner("Processing audio samples..."):
|
| 14 |
+
processed_samples = process_audio_samples(samples)
|
| 15 |
+
with st.spinner("Restoring speech..."):
|
| 16 |
+
result = restore_speech(processed_samples)
|
| 17 |
+
st.success("Speech restoration complete!")
|
| 18 |
+
st.audio(result, format='audio/wav')
|
| 19 |
+
else:
|
| 20 |
+
st.warning("Please upload audio samples.")
|