Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ from datetime import datetime
|
|
| 8 |
import gradio as gr
|
| 9 |
import torch
|
| 10 |
from fairseq import checkpoint_utils
|
|
|
|
| 11 |
|
| 12 |
from infer_pack.models import SynthesizerTrnMs256NSFsid, SynthesizerTrnMs256NSFsid_nono
|
| 13 |
from vc_infer_pipeline import VC
|
|
@@ -17,10 +18,10 @@ logging.getLogger("numba").setLevel(logging.WARNING)
|
|
| 17 |
|
| 18 |
|
| 19 |
def create_vc_fn(tgt_sr, net_g, vc, if_f0, file_index, file_big_npy):
|
| 20 |
-
def vc_fn(
|
| 21 |
try:
|
| 22 |
-
#
|
| 23 |
-
audio, sr =
|
| 24 |
|
| 25 |
# Your existing processing logic for audio
|
| 26 |
times = [0, 0, 0]
|
|
@@ -118,8 +119,8 @@ if __name__ == '__main__':
|
|
| 118 |
)
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column():
|
| 121 |
-
# Use
|
| 122 |
-
|
| 123 |
vc_transpose = gr.Number(label="Transpose", value=0)
|
| 124 |
vc_f0method = gr.Radio(
|
| 125 |
label="Pitch extraction algorithm, PM is fast but Harvest is better for low frequencies",
|
|
@@ -139,5 +140,5 @@ if __name__ == '__main__':
|
|
| 139 |
vc_output1 = gr.Textbox(label="Output Message")
|
| 140 |
vc_output2 = gr.Audio(label="Output Audio")
|
| 141 |
|
| 142 |
-
vc_submit.click(vc_fn, [
|
| 143 |
-
app.queue(concurrency_count=1, max_size=20, api_open=args.api).launch(share=args.share)
|
|
|
|
| 8 |
import gradio as gr
|
| 9 |
import torch
|
| 10 |
from fairseq import checkpoint_utils
|
| 11 |
+
import librosa
|
| 12 |
|
| 13 |
from infer_pack.models import SynthesizerTrnMs256NSFsid, SynthesizerTrnMs256NSFsid_nono
|
| 14 |
from vc_infer_pipeline import VC
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
def create_vc_fn(tgt_sr, net_g, vc, if_f0, file_index, file_big_npy):
|
| 21 |
+
def vc_fn(vc_audio_file, vc_transpose, vc_f0method, vc_index_ratio):
|
| 22 |
try:
|
| 23 |
+
# Load the audio file uploaded via Gradio
|
| 24 |
+
audio, sr = librosa.load(vc_audio_file.name, sr=None, mono=True)
|
| 25 |
|
| 26 |
# Your existing processing logic for audio
|
| 27 |
times = [0, 0, 0]
|
|
|
|
| 119 |
)
|
| 120 |
with gr.Row():
|
| 121 |
with gr.Column():
|
| 122 |
+
# Use file upload instead of microphone
|
| 123 |
+
vc_audio_file = gr.File(label="Upload your audio file", type="audio")
|
| 124 |
vc_transpose = gr.Number(label="Transpose", value=0)
|
| 125 |
vc_f0method = gr.Radio(
|
| 126 |
label="Pitch extraction algorithm, PM is fast but Harvest is better for low frequencies",
|
|
|
|
| 140 |
vc_output1 = gr.Textbox(label="Output Message")
|
| 141 |
vc_output2 = gr.Audio(label="Output Audio")
|
| 142 |
|
| 143 |
+
vc_submit.click(vc_fn, [vc_audio_file, vc_transpose, vc_f0method, vc_index_ratio], [vc_output1, vc_output2])
|
| 144 |
+
app.queue(concurrency_count=1, max_size=20, api_open=args.api).launch(share=args.share)
|