Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import torchaudio
|
|
| 3 |
from sgmse.model import ScoreModel
|
| 4 |
import gradio as gr
|
| 5 |
from sgmse.util.other import pad_spec
|
|
|
|
| 6 |
|
| 7 |
# Define parameters based on the argparse configuration in enhancement.py
|
| 8 |
args = {
|
|
@@ -20,7 +21,7 @@ args = {
|
|
| 20 |
model = ScoreModel.load_from_checkpoint(args["ckpt"])
|
| 21 |
|
| 22 |
def enhance_speech(audio_file):
|
| 23 |
-
start_time = time.time()
|
| 24 |
|
| 25 |
# Load and process the audio file
|
| 26 |
y, sr = torchaudio.load(audio_file)
|
|
@@ -57,7 +58,6 @@ def enhance_speech(audio_file):
|
|
| 57 |
print(f"Processed audio in {time.time() - start_time:.2f}s")
|
| 58 |
return output_file
|
| 59 |
|
| 60 |
-
|
| 61 |
# Gradio interface setup
|
| 62 |
inputs = gr.Audio(label="Input Audio", type="filepath")
|
| 63 |
outputs = gr.Audio(label="Output Audio", type="filepath")
|
|
|
|
| 3 |
from sgmse.model import ScoreModel
|
| 4 |
import gradio as gr
|
| 5 |
from sgmse.util.other import pad_spec
|
| 6 |
+
import time # Import the time module
|
| 7 |
|
| 8 |
# Define parameters based on the argparse configuration in enhancement.py
|
| 9 |
args = {
|
|
|
|
| 21 |
model = ScoreModel.load_from_checkpoint(args["ckpt"])
|
| 22 |
|
| 23 |
def enhance_speech(audio_file):
|
| 24 |
+
start_time = time.time() # Start the timer
|
| 25 |
|
| 26 |
# Load and process the audio file
|
| 27 |
y, sr = torchaudio.load(audio_file)
|
|
|
|
| 58 |
print(f"Processed audio in {time.time() - start_time:.2f}s")
|
| 59 |
return output_file
|
| 60 |
|
|
|
|
| 61 |
# Gradio interface setup
|
| 62 |
inputs = gr.Audio(label="Input Audio", type="filepath")
|
| 63 |
outputs = gr.Audio(label="Output Audio", type="filepath")
|