Spaces:
Paused
Paused
Commit
·
c5d5c61
1
Parent(s):
845df18
add new ckpt
Browse files- app.py +21 -7
- pytorch_model.bin +1 -1
- restored_output.wav +0 -0
app.py
CHANGED
|
@@ -11,22 +11,36 @@ model = AutoModel.from_pretrained(checkpoint_path, trust_remote_code=True)
|
|
| 11 |
|
| 12 |
@spaces.GPU()
|
| 13 |
def restore_audio(input_audio):
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
output_path = "restored_output.wav"
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
return output_path
|
| 18 |
|
| 19 |
|
| 20 |
with gr.Blocks() as demo:
|
| 21 |
-
gr.Markdown("
|
| 22 |
gr.Markdown(
|
| 23 |
"""
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
"""
|
| 29 |
)
|
|
|
|
| 30 |
|
| 31 |
with gr.Row():
|
| 32 |
with gr.Column():
|
|
|
|
| 11 |
|
| 12 |
@spaces.GPU()
|
| 13 |
def restore_audio(input_audio):
|
| 14 |
+
# Load the audio file
|
| 15 |
+
waveform, sample_rate = torchaudio.load(input_audio)
|
| 16 |
+
|
| 17 |
+
# Calculate the duration of the audio (in seconds)
|
| 18 |
+
duration = waveform.shape[1] / sample_rate
|
| 19 |
+
|
| 20 |
+
# Output file path
|
| 21 |
output_path = "restored_output.wav"
|
| 22 |
+
|
| 23 |
+
if duration > 10:
|
| 24 |
+
model(input_audio, output_path, short=False)
|
| 25 |
+
else:
|
| 26 |
+
model(input_audio, output_path) # short=True by default
|
| 27 |
+
|
| 28 |
return output_path
|
| 29 |
|
| 30 |
|
| 31 |
with gr.Blocks() as demo:
|
| 32 |
+
gr.Markdown("# 🔊 Voice Restoration with Transformer-based Model")
|
| 33 |
gr.Markdown(
|
| 34 |
"""
|
| 35 |
+
Upload a degraded audio file or select an example, and the space will restore it using the **VoiceRestore** model!
|
| 36 |
+
|
| 37 |
+
Based on this [repo](https://github.com/skirdey/voicerestore) by [@Stan Kirdey](https://github.com/skirdey),
|
| 38 |
+
and the HF Transformers 🤗 [Model](https://huggingface.co/jadechoghari/VoiceRestore) by [@jadechoghari](https://github.com/jadechoghari).
|
| 39 |
+
|
| 40 |
+
The model returns optimized results for audio less than 10 seconds, however, it supports unlimited duration!
|
| 41 |
"""
|
| 42 |
)
|
| 43 |
+
|
| 44 |
|
| 45 |
with gr.Row():
|
| 46 |
with gr.Column():
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1204445470
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d8ebdc57b002abd36d71ea2d5d0955380b46f283b7953baaf3bcb09f67ad135
|
| 3 |
size 1204445470
|
restored_output.wav
ADDED
|
Binary file (279 kB). View file
|
|
|