Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import subprocess
|
3 |
import os
|
4 |
|
5 |
-
def run_ultrasinger(opt_i, opt_o, mode,
|
6 |
# Construct the command based on inputs
|
7 |
cmd = ["python", "UltraSinger.py"]
|
8 |
|
@@ -17,12 +17,14 @@ def run_ultrasinger(opt_i, opt_o, mode, transcription, pitcher, extra, device):
|
|
17 |
cmd.extend(mode.split())
|
18 |
|
19 |
# Add transcription options
|
20 |
-
if
|
21 |
-
cmd.extend(
|
|
|
|
|
22 |
|
23 |
# Add pitcher options
|
24 |
-
if
|
25 |
-
cmd.extend(
|
26 |
|
27 |
# Add extra options
|
28 |
if extra:
|
@@ -40,11 +42,27 @@ def run_ultrasinger(opt_i, opt_o, mode, transcription, pitcher, extra, device):
|
|
40 |
return str(e), "Error occurred during execution"
|
41 |
|
42 |
# Define Gradio inputs and outputs
|
43 |
-
opt_i = gr.File(label="Ultrastar.txt or audio file (.mp3, .wav,
|
44 |
opt_o = gr.Textbox(label="Output folder")
|
45 |
-
mode = gr.
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
extra = gr.Textbox(label="Extra options (e.g., --hyphenation True)")
|
49 |
device = gr.Textbox(label="Device options (e.g., --force_cpu False)")
|
50 |
|
@@ -54,9 +72,9 @@ error_text = gr.Textbox(label="Error Output")
|
|
54 |
# Create Gradio interface
|
55 |
interface = gr.Interface(
|
56 |
fn=run_ultrasinger,
|
57 |
-
inputs=[opt_i, opt_o, mode,
|
58 |
outputs=[output_text, error_text],
|
59 |
-
title="UltraSinger
|
60 |
description="Upload an Ultrastar.txt or an audio file, set the options, and run UltraSinger."
|
61 |
)
|
62 |
|
|
|
2 |
import subprocess
|
3 |
import os
|
4 |
|
5 |
+
def run_ultrasinger(opt_i, opt_o, mode, whisper_model, language, crepe_model, extra, device):
|
6 |
# Construct the command based on inputs
|
7 |
cmd = ["python", "UltraSinger.py"]
|
8 |
|
|
|
17 |
cmd.extend(mode.split())
|
18 |
|
19 |
# Add transcription options
|
20 |
+
if whisper_model:
|
21 |
+
cmd.extend(["--whisper", whisper_model])
|
22 |
+
if language:
|
23 |
+
cmd.extend(["--language", language])
|
24 |
|
25 |
# Add pitcher options
|
26 |
+
if crepe_model:
|
27 |
+
cmd.extend(["--crepe", crepe_model])
|
28 |
|
29 |
# Add extra options
|
30 |
if extra:
|
|
|
42 |
return str(e), "Error occurred during execution"
|
43 |
|
44 |
# Define Gradio inputs and outputs
|
45 |
+
opt_i = gr.File(label="Ultrastar.txt or audio file (.mp3, .wav, .txt)")
|
46 |
opt_o = gr.Textbox(label="Output folder")
|
47 |
+
mode = gr.Dropdown(
|
48 |
+
label="Mode options",
|
49 |
+
choices=["default", "-u", "-m", "-s", "-r", "-p"],
|
50 |
+
value="default"
|
51 |
+
)
|
52 |
+
whisper_model = gr.Dropdown(
|
53 |
+
label="Whisper Model",
|
54 |
+
choices=[
|
55 |
+
"tiny", "base", "small", "medium", "large-v1", "large-v2",
|
56 |
+
"tiny.en", "base.en", "small.en", "medium.en"
|
57 |
+
],
|
58 |
+
value="large-v2"
|
59 |
+
)
|
60 |
+
language = gr.Textbox(label="Language (e.g., en)")
|
61 |
+
crepe_model = gr.Dropdown(
|
62 |
+
label="Crepe Model",
|
63 |
+
choices=["tiny", "full"],
|
64 |
+
value="full"
|
65 |
+
)
|
66 |
extra = gr.Textbox(label="Extra options (e.g., --hyphenation True)")
|
67 |
device = gr.Textbox(label="Device options (e.g., --force_cpu False)")
|
68 |
|
|
|
72 |
# Create Gradio interface
|
73 |
interface = gr.Interface(
|
74 |
fn=run_ultrasinger,
|
75 |
+
inputs=[opt_i, opt_o, mode, whisper_model, language, crepe_model, extra, device],
|
76 |
outputs=[output_text, error_text],
|
77 |
+
title="UltraSinger UI",
|
78 |
description="Upload an Ultrastar.txt or an audio file, set the options, and run UltraSinger."
|
79 |
)
|
80 |
|