Commit
·
435ad61
1
Parent(s):
4f1e982
test log in new
Browse files
app.py
CHANGED
@@ -54,6 +54,10 @@ except (ValueError, TypeError, IndexError):
|
|
54 |
DoFormant, Quefrency, Timbre = False, 1.0, 1.0
|
55 |
CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, Quefrency, Timbre)
|
56 |
|
|
|
|
|
|
|
|
|
57 |
def download_models():
|
58 |
# Download hubert base model if not present
|
59 |
if not os.path.isfile('./hubert_base.pt'):
|
@@ -237,6 +241,7 @@ hubert_model = None
|
|
237 |
voicecraft_model = None
|
238 |
voicecraft_config = None
|
239 |
phn2num = None
|
|
|
240 |
|
241 |
def load_hubert():
|
242 |
global hubert_model
|
@@ -518,16 +523,25 @@ def get_vc(sid):
|
|
518 |
return {"visible": False, "maximum": n_spk, "__type__": "update"}
|
519 |
|
520 |
|
521 |
-
def change_choices():
|
522 |
names = []
|
|
|
523 |
for name in os.listdir(weight_root):
|
524 |
if name.endswith(".pth"):
|
525 |
-
|
|
|
|
|
|
|
|
|
526 |
index_paths = []
|
527 |
for root, dirs, files in os.walk(index_root, topdown=False):
|
528 |
for name in files:
|
529 |
if name.endswith(".index") and "trained" not in name:
|
530 |
-
|
|
|
|
|
|
|
|
|
531 |
return {"choices": sorted(names), "__type__": "update"}, {
|
532 |
"choices": sorted(index_paths),
|
533 |
"__type__": "update",
|
@@ -1366,7 +1380,7 @@ def check_for_name():
|
|
1366 |
else:
|
1367 |
return ''
|
1368 |
|
1369 |
-
def download_from_url(url, model):
|
1370 |
if url == '':
|
1371 |
return "URL cannot be left empty."
|
1372 |
if model =='':
|
@@ -1400,8 +1414,11 @@ def download_from_url(url, model):
|
|
1400 |
if file.endswith(".index"):
|
1401 |
os.mkdir(f'./logs/{model}')
|
1402 |
shutil.copy2(file_path,f'./logs/{model}')
|
|
|
1403 |
elif "G_" not in file and "D_" not in file and file.endswith(".pth"):
|
1404 |
shutil.copy(file_path,f'./weights/{model}.pth')
|
|
|
|
|
1405 |
shutil.rmtree("zips")
|
1406 |
shutil.rmtree("unzips")
|
1407 |
change_choices()
|
@@ -1569,7 +1586,7 @@ def run_joint(seed, stop_repetition, sample_batch_size, left_margin, right_margi
|
|
1569 |
os.environ["USER"] = "USER"
|
1570 |
# take a look at demo/temp/mfa_alignment, decide which part of the audio to use as prompt
|
1571 |
cut_off_sec = cutoff_value # NOTE: according to forced-alignment file, the word "common" stop as 3.01 sec, this should be different for different audio
|
1572 |
-
target_transcript = transcribed_text + target_transcript
|
1573 |
print(target_transcript)
|
1574 |
info = torchaudio.info(audio_fn)
|
1575 |
audio_dur = info.num_frames / info.sample_rate
|
@@ -1705,6 +1722,7 @@ def zip_downloader(model):
|
|
1705 |
download_from_url('https://drive.google.com/uc?id=1O98vvnle_nZP8ZdpnZFLZ5TU1UZe7x0p&confirm=t', 'JVKE-main')
|
1706 |
download_from_url('https://drive.google.com/uc?id=1Wag0vPlp42kRDffccXljjjlK7QsHf2xe&confirm=t', 'JVKE-main-v2')
|
1707 |
download_from_url('https://drive.google.com/uc?id=1h810cil3YRlN4pu4oO43zKq9z3cYjItp&confirm=t', 'jvke-nighttime-v4')
|
|
|
1708 |
weight_root = "weights"
|
1709 |
index_root = "logs"
|
1710 |
names = []
|
@@ -1721,17 +1739,7 @@ for root, dirs, files in os.walk(index_root, topdown=False):
|
|
1721 |
with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose"), title="HITGEN AI") as app:
|
1722 |
with gr.Tabs():
|
1723 |
with gr.TabItem("Inference"):
|
1724 |
-
|
1725 |
-
# gr.HTML("<h10> You can find voice models on AI Hub: https://discord.gg/aihub </h10>")
|
1726 |
-
# gr.HTML("<h4> Huggingface port by Ilaria of the Rejekt Easy GUI </h4>")
|
1727 |
-
|
1728 |
-
# Inference Preset Row
|
1729 |
-
# with gr.Row():
|
1730 |
-
# mangio_preset = gr.Dropdown(label="Inference Preset", choices=sorted(get_presets()))
|
1731 |
-
# mangio_preset_name_save = gr.Textbox(
|
1732 |
-
# label="Your preset name"
|
1733 |
-
# )
|
1734 |
-
# mangio_preset_save_btn = gr.Button('Save Preset', variant="primary")
|
1735 |
|
1736 |
# Other RVC stuff
|
1737 |
with gr.Row():
|
@@ -2399,5 +2407,5 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose")
|
|
2399 |
"-------------------------------\n"
|
2400 |
)
|
2401 |
|
2402 |
-
app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=False, auth=('jvke', 'thisfeelslikeai'))
|
2403 |
#endregion
|
|
|
54 |
DoFormant, Quefrency, Timbre = False, 1.0, 1.0
|
55 |
CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, Quefrency, Timbre)
|
56 |
|
57 |
+
def update_message(request: gr.Request):
|
58 |
+
change_choices(request.username)
|
59 |
+
return f"Welcome, {request.username}"
|
60 |
+
|
61 |
def download_models():
|
62 |
# Download hubert base model if not present
|
63 |
if not os.path.isfile('./hubert_base.pt'):
|
|
|
241 |
voicecraft_model = None
|
242 |
voicecraft_config = None
|
243 |
phn2num = None
|
244 |
+
associated_links = {}
|
245 |
|
246 |
def load_hubert():
|
247 |
global hubert_model
|
|
|
523 |
return {"visible": False, "maximum": n_spk, "__type__": "update"}
|
524 |
|
525 |
|
526 |
+
def change_choices(username=None):
|
527 |
names = []
|
528 |
+
print(associated_links)
|
529 |
for name in os.listdir(weight_root):
|
530 |
if name.endswith(".pth"):
|
531 |
+
if username is None:
|
532 |
+
names.append(name)
|
533 |
+
else:
|
534 |
+
if associated_links.get(name) == username:
|
535 |
+
names.append(name)
|
536 |
index_paths = []
|
537 |
for root, dirs, files in os.walk(index_root, topdown=False):
|
538 |
for name in files:
|
539 |
if name.endswith(".index") and "trained" not in name:
|
540 |
+
if username is None:
|
541 |
+
index_paths.append("%s/%s" % (root, name))
|
542 |
+
else:
|
543 |
+
if associated_links.get(name) == username:
|
544 |
+
index_paths.append("%s/%s" % (root, name))
|
545 |
return {"choices": sorted(names), "__type__": "update"}, {
|
546 |
"choices": sorted(index_paths),
|
547 |
"__type__": "update",
|
|
|
1380 |
else:
|
1381 |
return ''
|
1382 |
|
1383 |
+
def download_from_url(url, model, associated_user=None):
|
1384 |
if url == '':
|
1385 |
return "URL cannot be left empty."
|
1386 |
if model =='':
|
|
|
1414 |
if file.endswith(".index"):
|
1415 |
os.mkdir(f'./logs/{model}')
|
1416 |
shutil.copy2(file_path,f'./logs/{model}')
|
1417 |
+
associated_links[file] = associated_user
|
1418 |
elif "G_" not in file and "D_" not in file and file.endswith(".pth"):
|
1419 |
shutil.copy(file_path,f'./weights/{model}.pth')
|
1420 |
+
if associated_user is not None:
|
1421 |
+
associated_links[f'{model}.pth'] = associated_user
|
1422 |
shutil.rmtree("zips")
|
1423 |
shutil.rmtree("unzips")
|
1424 |
change_choices()
|
|
|
1586 |
os.environ["USER"] = "USER"
|
1587 |
# take a look at demo/temp/mfa_alignment, decide which part of the audio to use as prompt
|
1588 |
cut_off_sec = cutoff_value # NOTE: according to forced-alignment file, the word "common" stop as 3.01 sec, this should be different for different audio
|
1589 |
+
target_transcript = transcribed_text + ' ' + target_transcript
|
1590 |
print(target_transcript)
|
1591 |
info = torchaudio.info(audio_fn)
|
1592 |
audio_dur = info.num_frames / info.sample_rate
|
|
|
1722 |
download_from_url('https://drive.google.com/uc?id=1O98vvnle_nZP8ZdpnZFLZ5TU1UZe7x0p&confirm=t', 'JVKE-main')
|
1723 |
download_from_url('https://drive.google.com/uc?id=1Wag0vPlp42kRDffccXljjjlK7QsHf2xe&confirm=t', 'JVKE-main-v2')
|
1724 |
download_from_url('https://drive.google.com/uc?id=1h810cil3YRlN4pu4oO43zKq9z3cYjItp&confirm=t', 'jvke-nighttime-v4')
|
1725 |
+
download_from_url('https://drive.google.com/uc?id=1fa6FSLwqSQMI49NvSXOpI4pUVuKsrop5&confirm=t', 'Andoni')
|
1726 |
weight_root = "weights"
|
1727 |
index_root = "logs"
|
1728 |
names = []
|
|
|
1739 |
with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose"), title="HITGEN AI") as app:
|
1740 |
with gr.Tabs():
|
1741 |
with gr.TabItem("Inference"):
|
1742 |
+
app.load(update_message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1743 |
|
1744 |
# Other RVC stuff
|
1745 |
with gr.Row():
|
|
|
2407 |
"-------------------------------\n"
|
2408 |
)
|
2409 |
|
2410 |
+
app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=False, auth=[('jvke', 'thisfeelslikeai'), ('cmss60', 'yourseedislate')])
|
2411 |
#endregion
|