Spaces:
Running
Running
Update main/app/app.py
Browse files- main/app/app.py +3 -28
main/app/app.py
CHANGED
|
@@ -1,32 +1,19 @@
|
|
| 1 |
import os
|
| 2 |
-
import re
|
| 3 |
-
import ssl
|
| 4 |
import sys
|
| 5 |
-
import json
|
| 6 |
import torch
|
| 7 |
-
import codecs
|
| 8 |
import shutil
|
| 9 |
-
import asyncio
|
| 10 |
import librosa
|
| 11 |
import logging
|
| 12 |
-
import datetime
|
| 13 |
-
import platform
|
| 14 |
import requests
|
| 15 |
-
import warnings
|
| 16 |
-
import threading
|
| 17 |
import subprocess
|
| 18 |
-
import logging.handlers
|
| 19 |
-
|
| 20 |
import numpy as np
|
| 21 |
import gradio as gr
|
| 22 |
-
import pandas as pd
|
| 23 |
import soundfile as sf
|
| 24 |
-
|
| 25 |
from time import sleep
|
| 26 |
from multiprocessing import cpu_count
|
| 27 |
from main.app.tabs.inference.inference import inference_tabs
|
| 28 |
from main.app.tabs.models.model import model_tabs
|
| 29 |
-
from main.app
|
| 30 |
|
| 31 |
sys.path.append(os.getcwd())
|
| 32 |
|
|
@@ -34,7 +21,7 @@ from main.tools import huggingface
|
|
| 34 |
from main.configs.config import Config
|
| 35 |
from main.app.based.utils import *
|
| 36 |
|
| 37 |
-
with gr.Blocks(title="
|
| 38 |
gr.HTML("<h1 style='text-align: center;'>Ultimate RVC Maker ⚡</h1>")
|
| 39 |
|
| 40 |
with gr.Tabs():
|
|
@@ -71,13 +58,10 @@ with gr.Blocks(title=" Ultimate RVC Maker ⚡", theme=theme) as app:
|
|
| 71 |
overlap = gr.Radio(label=translations["overlap"], info=translations["overlap_info"], choices=["0.25", "0.5", "0.75", "0.99"], value="0.25", interactive=True)
|
| 72 |
with gr.Row():
|
| 73 |
mdx_hop_length = gr.Slider(label="Hop length", info=translations["hop_length_info"], minimum=1, maximum=8192, value=1024, step=1, interactive=True, visible=backing.value or reverb.value or separator_model.value in mdx_model)
|
| 74 |
-
|
| 75 |
-
|
| 76 |
with gr.Column():
|
| 77 |
with gr.Row():
|
| 78 |
clean_strength = gr.Slider(label=translations["clean_strength"], info=translations["clean_strength_info"], minimum=0, maximum=1, value=0.5, step=0.1, interactive=True, visible=cleaner.value)
|
| 79 |
sample_rate1 = gr.Slider(minimum=8000, maximum=96000, step=1, value=44100, label=translations["sr"], info=translations["sr_info"], interactive=True)
|
| 80 |
-
|
| 81 |
with gr.Column():
|
| 82 |
input = gr.File(label=translations["drop_audio"], file_types=[".wav", ".mp3", ".flac", ".ogg", ".opus", ".m4a", ".mp4", ".aac", ".alac", ".wma", ".aiff", ".webm", ".ac3"])
|
| 83 |
audio_input = gr.Audio(show_download_button=True, interactive=False, label=translations["input_audio"])
|
|
@@ -85,14 +69,12 @@ with gr.Blocks(title=" Ultimate RVC Maker ⚡", theme=theme) as app:
|
|
| 85 |
with gr.Accordion(translations["use_url"], open=False):
|
| 86 |
url = gr.Textbox(label=translations["url_audio"], value="", placeholder="https://www.youtube.com/...", scale=6)
|
| 87 |
download_button = gr.Button(translations["downloads"])
|
| 88 |
-
|
| 89 |
with gr.Column():
|
| 90 |
with gr.Accordion(translations["input_output"], open=False):
|
| 91 |
format = gr.Radio(label=translations["export_format"], info=translations["export_info"], choices=["wav", "mp3", "flac", "ogg", "opus", "m4a", "mp4", "aac", "alac", "wma", "aiff", "webm", "ac3"], value="wav", interactive=True)
|
| 92 |
input_audio = gr.Dropdown(label=translations["audio_path"], value="", choices=paths_for_files, allow_custom_value=True, interactive=True)
|
| 93 |
refesh_separator = gr.Button(translations["refesh"])
|
| 94 |
output_separator = gr.Textbox(label=translations["output_folder"], value="audios", placeholder="audios", info=translations["output_folder_info"], interactive=True)
|
| 95 |
-
|
| 96 |
with gr.Row():
|
| 97 |
gr.Markdown(translations["output_separator"])
|
| 98 |
with gr.Row():
|
|
@@ -144,14 +126,10 @@ with gr.Blocks(title=" Ultimate RVC Maker ⚡", theme=theme) as app:
|
|
| 144 |
|
| 145 |
with gr.TabItem("Inference"):
|
| 146 |
inference_tabs()
|
| 147 |
-
|
| 148 |
-
|
| 149 |
with gr.TabItem("Model Options"):
|
| 150 |
model_tabs()
|
| 151 |
-
|
| 152 |
with gr.TabItem("Utils"):
|
| 153 |
utils_tabs()
|
| 154 |
-
|
| 155 |
with gr.TabItem(translations["settings"], visible=configs.get("settings_tab", True)):
|
| 156 |
gr.Markdown(translations["settings_markdown"])
|
| 157 |
with gr.Row():
|
|
@@ -205,12 +183,9 @@ with gr.Blocks(title=" Ultimate RVC Maker ⚡", theme=theme) as app:
|
|
| 205 |
train_stop.click(fn=lambda model_name_stop: stop_pid("train_pid", model_name_stop, True), inputs=[model_name_stop], outputs=[])
|
| 206 |
with gr.Row():
|
| 207 |
audioldm2_stop.click(fn=lambda: stop_pid("audioldm2_pid", None, False), inputs=[], outputs=[])
|
| 208 |
-
|
| 209 |
-
|
| 210 |
|
| 211 |
with gr.Row():
|
| 212 |
gr.Markdown(translations["terms_of_use"])
|
| 213 |
-
|
| 214 |
gr.Markdown(translations["exemption"])
|
| 215 |
|
| 216 |
logger.info(translations["start_app"])
|
|
@@ -235,4 +210,4 @@ with gr.Blocks(title=" Ultimate RVC Maker ⚡", theme=theme) as app:
|
|
| 235 |
port -= 1
|
| 236 |
except Exception as e:
|
| 237 |
logger.error(translations["error_occurred"].format(e=e))
|
| 238 |
-
sys.exit(1)
|
|
|
|
| 1 |
import os
|
|
|
|
|
|
|
| 2 |
import sys
|
|
|
|
| 3 |
import torch
|
|
|
|
| 4 |
import shutil
|
|
|
|
| 5 |
import librosa
|
| 6 |
import logging
|
|
|
|
|
|
|
| 7 |
import requests
|
|
|
|
|
|
|
| 8 |
import subprocess
|
|
|
|
|
|
|
| 9 |
import numpy as np
|
| 10 |
import gradio as gr
|
|
|
|
| 11 |
import soundfile as sf
|
|
|
|
| 12 |
from time import sleep
|
| 13 |
from multiprocessing import cpu_count
|
| 14 |
from main.app.tabs.inference.inference import inference_tabs
|
| 15 |
from main.app.tabs.models.model import model_tabs
|
| 16 |
+
from main.app.tabs.utils.utils import utils_tabs
|
| 17 |
|
| 18 |
sys.path.append(os.getcwd())
|
| 19 |
|
|
|
|
| 21 |
from main.configs.config import Config
|
| 22 |
from main.app.based.utils import *
|
| 23 |
|
| 24 |
+
with gr.Blocks(title="Ultimate RVC Maker ⚡", theme=theme) as app:
|
| 25 |
gr.HTML("<h1 style='text-align: center;'>Ultimate RVC Maker ⚡</h1>")
|
| 26 |
|
| 27 |
with gr.Tabs():
|
|
|
|
| 58 |
overlap = gr.Radio(label=translations["overlap"], info=translations["overlap_info"], choices=["0.25", "0.5", "0.75", "0.99"], value="0.25", interactive=True)
|
| 59 |
with gr.Row():
|
| 60 |
mdx_hop_length = gr.Slider(label="Hop length", info=translations["hop_length_info"], minimum=1, maximum=8192, value=1024, step=1, interactive=True, visible=backing.value or reverb.value or separator_model.value in mdx_model)
|
|
|
|
|
|
|
| 61 |
with gr.Column():
|
| 62 |
with gr.Row():
|
| 63 |
clean_strength = gr.Slider(label=translations["clean_strength"], info=translations["clean_strength_info"], minimum=0, maximum=1, value=0.5, step=0.1, interactive=True, visible=cleaner.value)
|
| 64 |
sample_rate1 = gr.Slider(minimum=8000, maximum=96000, step=1, value=44100, label=translations["sr"], info=translations["sr_info"], interactive=True)
|
|
|
|
| 65 |
with gr.Column():
|
| 66 |
input = gr.File(label=translations["drop_audio"], file_types=[".wav", ".mp3", ".flac", ".ogg", ".opus", ".m4a", ".mp4", ".aac", ".alac", ".wma", ".aiff", ".webm", ".ac3"])
|
| 67 |
audio_input = gr.Audio(show_download_button=True, interactive=False, label=translations["input_audio"])
|
|
|
|
| 69 |
with gr.Accordion(translations["use_url"], open=False):
|
| 70 |
url = gr.Textbox(label=translations["url_audio"], value="", placeholder="https://www.youtube.com/...", scale=6)
|
| 71 |
download_button = gr.Button(translations["downloads"])
|
|
|
|
| 72 |
with gr.Column():
|
| 73 |
with gr.Accordion(translations["input_output"], open=False):
|
| 74 |
format = gr.Radio(label=translations["export_format"], info=translations["export_info"], choices=["wav", "mp3", "flac", "ogg", "opus", "m4a", "mp4", "aac", "alac", "wma", "aiff", "webm", "ac3"], value="wav", interactive=True)
|
| 75 |
input_audio = gr.Dropdown(label=translations["audio_path"], value="", choices=paths_for_files, allow_custom_value=True, interactive=True)
|
| 76 |
refesh_separator = gr.Button(translations["refesh"])
|
| 77 |
output_separator = gr.Textbox(label=translations["output_folder"], value="audios", placeholder="audios", info=translations["output_folder_info"], interactive=True)
|
|
|
|
| 78 |
with gr.Row():
|
| 79 |
gr.Markdown(translations["output_separator"])
|
| 80 |
with gr.Row():
|
|
|
|
| 126 |
|
| 127 |
with gr.TabItem("Inference"):
|
| 128 |
inference_tabs()
|
|
|
|
|
|
|
| 129 |
with gr.TabItem("Model Options"):
|
| 130 |
model_tabs()
|
|
|
|
| 131 |
with gr.TabItem("Utils"):
|
| 132 |
utils_tabs()
|
|
|
|
| 133 |
with gr.TabItem(translations["settings"], visible=configs.get("settings_tab", True)):
|
| 134 |
gr.Markdown(translations["settings_markdown"])
|
| 135 |
with gr.Row():
|
|
|
|
| 183 |
train_stop.click(fn=lambda model_name_stop: stop_pid("train_pid", model_name_stop, True), inputs=[model_name_stop], outputs=[])
|
| 184 |
with gr.Row():
|
| 185 |
audioldm2_stop.click(fn=lambda: stop_pid("audioldm2_pid", None, False), inputs=[], outputs=[])
|
|
|
|
|
|
|
| 186 |
|
| 187 |
with gr.Row():
|
| 188 |
gr.Markdown(translations["terms_of_use"])
|
|
|
|
| 189 |
gr.Markdown(translations["exemption"])
|
| 190 |
|
| 191 |
logger.info(translations["start_app"])
|
|
|
|
| 210 |
port -= 1
|
| 211 |
except Exception as e:
|
| 212 |
logger.error(translations["error_occurred"].format(e=e))
|
| 213 |
+
sys.exit(1)
|