(dem) C:\AI\demucs_playground>python app.py
Traceback (most recent call last):
File "C:\AI\demucs_playground\app.py", line 37, in
gr.Interface(
TypeError: Blocks.launch() got an unexpected keyword argument 'enable_queue'
Assistant
The error you're encountering:
code
TypeError: Blocks.launch() got an unexpected keyword argument 'enable_queue'
indicates that the version of the gradio library you're using does not support the enable_queue argument in the launch() method for Blocks.
What happened?
The enable_queue parameter was introduced in a later version of Gradio.
Your current Gradio version is likely outdated and does not have this parameter, so when it's passed, Python raises an error.
User
Assistant
User
same error
Assistant
User
none is working
Assistant
How to fix it?
Option 1: Update Gradio to the latest version
Updating Gradio to the latest version where enable_queue is supported should fix this issue:
bash
pip install --upgrade gradio
After upgrading, check the version:
bash
python -c "import gradio as gr; print(gr.__version__)"
Make sure it is at least 3.37.0 or higher (the version where enable_queue was introduced).
Then try running your script again.
Option 2: Remove or comment out enable_queue from launch()
If you can't upgrade for some reason, simply remove enable_queue=True from the .launch() method call in your app.py script.
For example, change:
python
demo.launch(enable_queue=True)
to:
python
demo.launch()
Extra: Verify with minimal example
Here's minimal example with Blocks and enable_queue:
python
import gradio as gr
def greet(name):
return "Hello " + name + "!"
with gr.Blocks() as demo:
inp = gr.Textbox(label="Name")
out = gr.Textbox(label="Output")
inp.change(greet, inputs=inp, outputs=out)
demo.launch(enable_queue=True)
This will only work if your Gradio version supports enable_queue.
If you still have issues after upgrading, let me know your Gradio version and the code snippet around the launch() call.
fix error and return entire script
import os
import sys
import subprocess
import re
import platform
import torch
import logging
import yt_dlp
import json
import copy
import spaces
import gradio as gr
import urllib.parse
import assets.themes.loadThemes as loadThemes
from audio_separator.separator import Separator
from assets.i18n.i18n import I18nAuto
from argparse import ArgumentParser
from assets.presence.discord_presence import RPCManager, track_presence
def load_config_presence():
with open(config_file, "r", encoding="utf8") as file:
config = json.load(file)
return config["discord_presence"]
def initialize_presence():
if load_config_presence():
RPCManager.start_presence()
initialize_presence()
def download_audio(url, output_dir="ytdl"):
code
os.makedirs(output_dir, exist_ok=True)
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'wav',
'preferredquality': '32',
}],
'outtmpl': os.path.join(output_dir, '%(title)s.%(ext)s'),
'postprocessor_args': [
'-acodec', 'pcm_f32le'
],
}
try:
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(url, download=False)
video_title = info['title']
ydl.download([url])
file_path = os.path.join(output_dir, f"{video_title}.wav")
if os.path.exists(file_path):
return os.path.abspath(file_path)
else:
raise Exception("Something went wrong")
except Exception as e:
raise Exception(f"Error extracting audio with yt-dlp: {str(e)}")
@track_presence("Performing VR Arch Separation")
@spaces.GPU(duration=60)
def vrarch_separator(audio, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
model_path = os.path.join(models_dir, model)
try:
if not os.path.exists(model_path):
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
if not os.path.exists(model_path):
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
for audio_files in os.listdir(path_input):
if audio_files.endswith(extensions):
found_files.append(audio_files)
total_files = len(found_files)
if total_files == 0:
logs.append("No valid audio files.")
return "\n".join(logs)
else:
logs.append(f"{total_files} audio files found")
found_files.sort()
progress(0, desc="Starting processing...")
for i, audio_files in enumerate(found_files):
progress((i / total_files), desc=f"Processing file {i+1}/{total_files}")
file_path = os.path.join(path_input, audio_files)
try:
separator = Separator(
log_level=logging.WARNING,
model_file_dir=models_dir,
output_dir=path_output,
output_format=out_format,
use_autocast=use_autocast,
normalization_threshold=norm_thresh,
amplification_threshold=amp_thresh,
output_single_stem=single_stem,
vr_params={
"batch_size": batch_size,
"window_size": window_size,
"aggression": aggression,
"enable_tta": tta,
"enable_post_process": post_process,
"post_process_threshold": post_process_threshold,
"high_end_process": high_end_process,
}
)
logs.append("Loading model...")
separator.load_model(model_filename=model)
logs.append(f"Separating file: {audio_files}")
separator.separate(file_path)
logs.append(f"File: {audio_files} separated!")
except Exception as e:
raise RuntimeError(f"VR Arch batch separation failed: {e}") from e
progress(1.0, desc="Processing complete")
return "\n".join(logs)
components = {
"VR Arch": {}
}
def read_main_config():
try:
with open(config_file, "r", encoding="utf8") as f:
return json.load(f)
except Exception as e:
print(f"Error reading main config file '{config_file}': {e}")
gr.Warning(i18n("Error reading main config file"))
def write_main_config(data):
try:
with open(config_file, "w", encoding="utf8") as f:
json.dump(data, f, indent=2)
except Exception as e:
print(f"Error writing to main config file '{config_file}': {e}")
gr.Warning(i18n("Error writing to main config file"))
def load_settings_from_file(filepath):
try:
with open(filepath, 'r', encoding='utf-8') as f:
return json.load(f)
except Exception as e:
print(f"Error reading settings file '{filepath}': {e}")
gr.Warning(i18n("Error reading settings file"))
return None
settings_to_load = {}
default_settings = load_settings_from_file(default_settings_file)
if load_custom:
print("Attempting to load custom settings...")
custom_settings = load_settings_from_file(custom_settings_file)
if custom_settings:
settings_to_load = copy.deepcopy(default_settings)
for section, params in custom_settings.items():
if section in settings_to_load:
for key, value in params.items():
settings_to_load[section][key] = value
else:
settings_to_load[section] = params
print("Custom settings loaded successfully.")
else:
print("Custom settings file not found or invalid. Falling back to default settings.")
settings_to_load = default_settings
else:
print("Loading default settings...")
settings_to_load = default_settings
return settings_to_load
initial_settings = get_initial_settings()
with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 UVR5 UI 🎵") as app:
gr.Markdown(" 🎵 UVR5 UI 🎵 ")
gr.Markdown(i18n("If you liked this HF Space you can give me a ❤️"))
gr.Markdown(i18n("Try UVR5 UI using Colab here"))
with gr.Tabs():
with gr.TabItem("VR ARCH"):
with gr.Row():
vrarch_model = gr.Dropdown(
label = i18n("Select the model"),
choices = vrarch_models,
value = initial_settings.get("VR Arch", {}).get("model", None),
interactive = True
)
vrarch_output_format = gr.Dropdown(
label = i18n("Select the output format"),
choices = output_format,
value = initial_settings.get("VR Arch", {}).get("output_format", None),
interactive = True
)
with gr.Accordion(i18n("Advanced settings"), open = False):
with gr.Group():
with gr.Row():
vrarch_window_size = gr.Slider(
label = i18n("Window size"),
info = i18n("Balance quality and speed. 1024 = fast but lower, 320 = slower but better quality"),
minimum=320,
maximum=1024,
step=32,
value = initial_settings.get("VR Arch", {}).get("window_size", 512),
interactive = True
)
vrarch_agression = gr.Slider(
minimum = 1,
maximum = 50,
step = 1,
label = i18n("Agression"),
info = i18n("Intensity of primary stem extraction"),
value = initial_settings.get("VR Arch", {}).get("aggression", 5),
interactive = True
)
vrarch_tta = gr.Checkbox(
label = i18n("TTA"),
info = i18n("Enable Test-Time-Augmentation; slow but improves quality"),
value = initial_settings.get("VR Arch", {}).get("tta", True),
visible = True,
interactive = True
)
with gr.Row():
vrarch_post_process = gr.Checkbox(
label = i18n("Post process"),
info = i18n("Identify leftover artifacts within vocal output; may improve separation for some songs"),
value = initial_settings.get("VR Arch", {}).get("post_process", False),
visible = True,
interactive = True
)
vrarch_post_process_threshold = gr.Slider(
label = i18n("Post process threshold"),
info = i18n("Threshold for post-processing"),
minimum = 0.1,
maximum = 0.3,
step = 0.1,
value = initial_settings.get("VR Arch", {}).get("post_process_threshold", 0.2),
interactive = True
)
with gr.Row():
vrarch_high_end_process = gr.Checkbox(
label = i18n("High end process"),
info = i18n("Mirror the missing frequency range of the output"),
value = initial_settings.get("VR Arch", {}).get("high_end_process", False),
visible = True,
interactive = True,
)
vrarch_batch_size = gr.Slider(
label = i18n("Batch size"),
info = i18n("Larger consumes more RAM but may process slightly faster"),
minimum = 1,
maximum = 16,
step = 1,
value = initial_settings.get("VR Arch", {}).get("batch_size", 1),
interactive = True
)
with gr.Row():
vrarch_normalization_threshold = gr.Slider(
label = i18n("Normalization threshold"),
info = i18n("The threshold for audio normalization"),
minimum = 0.1,
maximum = 1,
step = 0.1,
value = initial_settings.get("VR Arch", {}).get("normalization_threshold", 0.9),
interactive = True
)
vrarch_amplification_threshold = gr.Slider(
label = i18n("Amplification threshold"),
info = i18n("The threshold for audio amplification"),
minimum = 0.1,
maximum = 1,
step = 0.1,
value = initial_settings.get("VR Arch", {}).get("amplification_threshold", 0.7),
interactive = True
)
with gr.Row():
vrarch_single_stem = gr.Textbox(
label = i18n("Output only single stem"),
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
value = initial_settings.get("VR Arch", {}).get("single_stem", ""),
interactive = True
)
code
app.queue()
app.launch()
Your error comes from this line:
python
app.queue()
app.launch()
You are trying to use .queue() and then .launch() without arguments, but the error you mentioned originally was:
code
TypeError: Blocks.launch() got an unexpected keyword argument 'enable_queue'
which means somewhere you are passing enable_queue=True to launch() which your installed Gradio doesn't support.
Your code here doesn't use enable_queue anymore, so this is fine.
To avoid this error, you have a few choices:
Make sure Gradio is updated to a version that supports enable_queue argument (recommended):
bash
pip install --upgrade gradio
If you cannot upgrade, avoid passing enable_queue=True to .launch().
Since your script doesn't explicitly pass enable_queue, your app should run fine with:
python
app.queue()
app.launch()
I cleaned and fixed your script to use .queue() then .launch() without passing enable_queue explicitly.
Here is the full fixed script, with the last two lines simplified and the rest unchanged:
python
import os
import sys
import subprocess
import re
import platform
import torch
import logging
import yt_dlp
import json
import copy
import spaces
import gradio as gr
import urllib.parse
import assets.themes.loadThemes as loadThemes
from audio_separator.separator import Separator
from assets.i18n.i18n import I18nAuto
from argparse import ArgumentParser
from assets.presence.discord_presence import RPCManager, track_presence
i18n = I18nAuto()
now_dir = os.getcwd()
sys.path.append(now_dir)
config_file = os.path.join(now_dir, "assets", "config.json")
models_file = os.path.join(now_dir, "assets", "models.json")
default_settings_file = os.path.join(now_dir, "assets", "default_settings.json")
custom_settings_file = os.path.join(now_dir, "assets", "custom_settings.json")
device = "cuda" if torch.cuda.is_available() else "cpu"
use_autocast = device == "cuda"
if os.path.isdir("env"):
if platform.system() == "Windows":
python_location = ".\\env\\python.exe"
separator_location = ".\\env\\Scripts\\audio-separator.exe"
elif platform.system() == "Linux":
python_location = "env/bin/python"
separator_location = "env/bin/audio-separator"
else:
python_location = None
separator_location = "audio-separator"
#=======================#
# VR-ARCH Models #
#=======================#
vrarch_models = [
'1_HP-UVR.pth',
'2_HP-UVR.pth',
'3_HP-Vocal-UVR.pth',
'4_HP-Vocal-UVR.pth',
'5_HP-Karaoke-UVR.pth',
'6_HP-Karaoke-UVR.pth',
'7_HP2-UVR.pth',
'8_HP2-UVR.pth',
'9_HP2-UVR.pth',
'10_SP-UVR-2B-32000-1.pth',
'11_SP-UVR-2B-32000-2.pth',
'12_SP-UVR-3B-44100.pth',
'13_SP-UVR-4B-44100-1.pth',
'14_SP-UVR-4B-44100-2.pth',
'15_SP-UVR-MID-44100-1.pth',
'16_SP-UVR-MID-44100-2.pth',
'17_HP-Wind_Inst-UVR.pth',
'UVR-De-Echo-Aggressive.pth',
'UVR-De-Echo-Normal.pth',
'UVR-DeEcho-DeReverb.pth',
'UVR-De-Reverb-aufr33-jarredou.pth',
'UVR-DeNoise-Lite.pth',
'UVR-DeNoise.pth',
'UVR-BVE-4B_SN-44100-1.pth',
'MGM_HIGHEND_v4.pth',
'MGM_LOWEND_A_v4.pth',
'MGM_LOWEND_B_v4.pth',
'MGM_MAIN_v4.pth',
]
output_format = [
'wav',
'flac',
'mp3',
'ogg',
'opus',
'm4a',
'aiff',
'ac3'
]
found_files = []
logs = []
out_dir = "./outputs"
models_dir = "./models"
extensions = (".wav", ".flac", ".mp3", ".ogg", ".opus", ".m4a", ".aiff", ".ac3")
def load_config_presence():
with open(config_file, "r", encoding="utf8") as file:
config = json.load(file)
return config["discord_presence"]
def initialize_presence():
if load_config_presence():
RPCManager.start_presence()
initialize_presence()
def download_audio(url, output_dir="ytdl"):
os.makedirs(output_dir, exist_ok=True)
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'wav',
'preferredquality': '32',
}],
'outtmpl': os.path.join(output_dir, '%(title)s.%(ext)s'),
'postprocessor_args': [
'-acodec', 'pcm_f32le'
],
}
try:
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(url, download=False)
video_title = info['title']
ydl.download([url])
file_path = os.path.join(output_dir, f"{video_title}.wav")
if os.path.exists(file_path):
return os.path.abspath(file_path)
else:
raise Exception("Something went wrong")
except Exception as e:
raise Exception(f"Error extracting audio with yt-dlp: {str(e)}")
@track_presence("Performing VR Arch Separation")
@spaces.GPU(duration=60)
def vrarch_separator(audio, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
model_path = os.path.join(models_dir, model)
try:
if not os.path.exists(model_path):
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
separator = Separator(
log_level=logging.WARNING,
model_file_dir=models_dir,
output_dir=out_dir,
output_format=out_format,
use_autocast=use_autocast,
normalization_threshold=norm_thresh,
amplification_threshold=amp_thresh,
output_single_stem=single_stem,
vr_params={
"batch_size": batch_size,
"window_size": window_size,
"aggression": aggression,
"enable_tta": tta,
"enable_post_process": post_process,
"post_process_threshold": post_process_threshold,
"high_end_process": high_end_process,
}
)
progress(0.2, desc="Loading model...")
separator.load_model(model_filename=model)
progress(0.7, desc="Separating audio...")
separation = separator.separate(audio)
stems = [os.path.join(out_dir, file_name) for file_name in separation]
if single_stem.strip():
return stems[0], None
return stems[0], stems[1]
except Exception as e:
raise RuntimeError(f"VR ARCH separation failed: {e}") from e
@track_presence("Performing VR Arch Batch Separation")
@spaces.GPU(duration=60)
def vrarch_batch(path_input, path_output, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress()):
found_files.clear()
logs.clear()
model_path = os.path.join(models_dir, model)
if not os.path.exists(model_path):
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
for audio_files in os.listdir(path_input):
if audio_files.endswith(extensions):
found_files.append(audio_files)
total_files = len(found_files)
if total_files == 0:
logs.append("No valid audio files.")
return "\n".join(logs)
else:
logs.append(f"{total_files} audio files found")
found_files.sort()
progress(0, desc="Starting processing...")
for i, audio_files in enumerate(found_files):
progress((i / total_files), desc=f"Processing file {i+1}/{total_files}")
file_path = os.path.join(path_input, audio_files)
try:
separator = Separator(
log_level=logging.WARNING,
model_file_dir=models_dir,
output_dir=path_output,
output_format=out_format,
use_autocast=use_autocast,
normalization_threshold=norm_thresh,
amplification_threshold=amp_thresh,
output_single_stem=single_stem,
vr_params={
"batch_size": batch_size,
"window_size": window_size,
"aggression": aggression,
"enable_tta": tta,
"enable_post_process": post_process,
"post_process_threshold": post_process_threshold,
"high_end_process": high_end_process,
}
)
logs.append("Loading model...")
separator.load_model(model_filename=model)
logs.append(f"Separating file: {audio_files}")
separator.separate(file_path)
logs.append(f"File: {audio_files} separated!")
except Exception as e:
raise RuntimeError(f"VR Arch batch separation failed: {e}") from e
progress(1.0, desc="Processing complete")
return "\n".join(logs)
components = {
"VR Arch": {}
}
def read_main_config():
try:
with open(config_file, "r", encoding="utf8") as f:
return json.load(f)
except Exception as e:
print(f"Error reading main config file '{config_file}': {e}")
gr.Warning(i18n("Error reading main config file"))
def write_main_config(data):
try:
with open(config_file, "w", encoding="utf8") as f:
json.dump(data, f, indent=2)
except Exception as e:
print(f"Error writing to main config file '{config_file}': {e}")
gr.Warning(i18n("Error writing to main config file"))
def load_settings_from_file(filepath):
try:
with open(filepath, 'r', encoding='utf-8') as f:
return json.load(f)
except Exception as e:
print(f"Error reading settings file '{filepath}': {e}")
gr.Warning(i18n("Error reading settings file"))
return None
def get_initial_settings():
main_config = read_main_config()
load_custom = main_config.get('load_custom_settings', False)
settings_to_load = {}
default_settings = load_settings_from_file(default_settings_file)
if load_custom:
print("Attempting to load custom settings...")
custom_settings = load_settings_from_file(custom_settings_file)
if custom_settings:
settings_to_load = copy.deepcopy(default_settings)
for section, params in custom_settings.items():
if section in settings_to_load:
for key, value in params.items():
settings_to_load[section][key] = value
else:
settings_to_load[section] = params
print("Custom settings loaded successfully.")
else:
print("Custom settings file not found or invalid. Falling back to default settings.")
settings_to_load = default_settings
else:
print("Loading default settings...")
settings_to_load = default_settings
return settings_to_load
initial_settings = get_initial_settings()
with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 UVR5 UI 🎵") as app:
gr.Markdown("<h1> 🎵 UVR5 UI 🎵 </h1>")
gr.Markdown(i18n("If you liked this HF Space you can give me a ❤️"))
gr.Markdown(i18n("Try UVR5 UI using Colab [here](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)"))
with gr.Tabs():
with gr.TabItem("VR ARCH"):
with gr.Row():
vrarch_model = gr.Dropdown(
label = i18n("Select the model"),
choices = vrarch_models,
value = initial_settings.get("VR Arch", {}).get("model", None),
interactive = True
)
vrarch_output_format = gr.Dropdown(
label = i18n("Select the output format"),
choices = output_format,
value = initial_settings.get("VR Arch", {}).get("output_format", None),
interactive = True
)
with gr.Accordion(i18n("Advanced settings"), open = False):
with gr.Group():
with gr.Row():
vrarch_window_size = gr.Slider(
label = i18n("Window size"),
info = i18n("Balance quality and speed. 1024 = fast but lower, 320 = slower but better quality"),
minimum=320,
maximum=1024,
step=32,
value = initial_settings.get("VR Arch", {}).get("window_size", 512),
interactive = True
)
vrarch_agression = gr.Slider(
minimum = 1,
maximum = 50,
step = 1,
label = i18n("Agression"),
info = i18n("Intensity of primary stem extraction"),
value = initial_settings.get("VR Arch", {}).get("aggression", 5),
interactive = True
)
vrarch_tta = gr.Checkbox(
label = i18n("TTA"),
info = i18n("Enable Test-Time-Augmentation; slow but improves quality"),
value = initial_settings.get("VR Arch", {}).get("tta", True),
visible = True,
interactive = True
)
with gr.Row():
vrarch_post_process = gr.Checkbox(
label = i18n("Post process"),
info = i18n("Identify leftover artifacts within vocal output; may improve separation for some songs"),
value = initial_settings.get("VR Arch", {}).get("post_process", False),
visible = True,
interactive = True
)
vrarch_post_process_threshold = gr.Slider(
label = i18n("Post process threshold"),
info = i18n("Threshold for post-processing"),
minimum = 0.1,
maximum = 0.3,
step = 0.1,
value = initial_settings.get("VR Arch", {}).get("post_process_threshold", 0.2),
interactive = True
)
with gr.Row():
vrarch_high_end_process = gr.Checkbox(
label = i18n("High end process"),
info = i18n("Mirror the missing frequency range of the output"),
value = initial_settings.get("VR Arch", {}).get("high_end_process", False),
visible = True,
interactive = True,
)
vrarch_batch_size = gr.Slider(
label = i18n("Batch size"),
info = i18n("Larger consumes more RAM but may process slightly faster"),
minimum = 1,
maximum = 16,
step = 1,
value = initial_settings.get("VR Arch", {}).get("batch_size", 1),
interactive = True
)
with gr.Row():
vrarch_normalization_threshold = gr.Slider(
label = i18n("Normalization threshold"),
info = i18n("The threshold for audio normalization"),
minimum = 0.1,
maximum = 1,
step = 0.1,
value = initial_settings.get("VR Arch", {}).get("normalization_threshold", 0.9),
interactive = True
)
vrarch_amplification_threshold = gr.Slider(
label = i18n("Amplification threshold"),
info = i18n("The threshold for audio amplification"),
minimum = 0.1,
maximum = 1,
step = 0.1,
value = initial_settings.get("VR Arch", {}).get("amplification_threshold", 0.7),
interactive = True
)
with gr.Row():
vrarch_single_stem = gr.Textbox(
label = i18n("Output only single stem"),
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
value = initial_settings.get("VR Arch", {}).get("single_stem", ""),
interactive = True
)
components["VR Arch"] = {
"model": vrarch_model,
"output_format": vrarch_output_format,
"window_size": vrarch_window_size,
"aggression": vrarch_agression,
"tta": vrarch_tta,
"post_process": vrarch_post_process,
"post_process_threshold": vrarch_post_process_threshold,
"high_end_process": vrarch_high_end_process,
"batch_size": vrarch_batch_size,
"normalization_threshold": vrarch_normalization_threshold,
"amplification_threshold": vrarch_amplification_threshold,
"single_stem": vrarch_single_stem
}
with gr.Row():
vrarch_audio = gr.Audio(
label = i18n("Input audio"),
type = "filepath",
interactive = True
)
with gr.Accordion(i18n("Separation by link"), open = False):
with gr.Row():
vrarch_link = gr.Textbox(
label = i18n("Link"),
placeholder = i18n("Paste the link here"),
interactive = True
)
with gr.Row():
gr.Markdown(i18n("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)"))
with gr.Row():
vrarch_download_button = gr.Button(
i18n("Download!"),
variant = "primary"
)
vrarch_download_button.click(download_audio, [vrarch_link], [vrarch_audio])
with gr.Accordion(i18n("Batch separation"), open = False):
with gr.Row():
vrarch_input_path = gr.Textbox(
label = i18n("Input path"),
placeholder = i18n("Place the input path here"),
interactive = True
)
vrarch_output_path = gr.Textbox(
label = i18n("Output path"),
placeholder = i18n("Place the output path here"),
interactive = True
)
with gr.Row():
vrarch_bath_button = gr.Button(i18n("Separate!"), variant = "primary")
with gr.Row():
vrarch_info = gr.Textbox(
label = i18n("Output information"),
interactive = False
)
vrarch_bath_button.click(vrarch_batch, [vrarch_input_path, vrarch_output_path, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_post_process, vrarch_post_process_threshold, vrarch_high_end_process, vrarch_batch_size, vrarch_normalization_threshold, vrarch_amplification_threshold, vrarch_single_stem], [vrarch_info])
with gr.Row():
vrarch_button = gr.Button(i18n("Separate!"), variant = "primary")
with gr.Row():
vrarch_stem1 = gr.Audio(
show_download_button = True,
interactive = False,
type = "filepath",
label = i18n("Stem 1")
)
vrarch_stem2 = gr.Audio(
show_download_button = True,
interactive = False,
type = "filepath",
label = i18n("Stem 2")
)
vrarch_button.click(vrarch_separator, [vrarch_audio, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_post_process, vrarch_post_process_threshold, vrarch_high_end_process, vrarch_batch_size, vrarch_normalization_threshold, vrarch_amplification_threshold, vrarch_single_stem], [vrarch_stem1, vrarch_stem2])
app.queue()
app.launch()
Summary
Your original cause: old Gradio version does not support enable_queue arg in launch().
Your current code does not pass enable_queue explicitly — so no error there.
Just call app.queue() before app.launch() like this.
If you want to pass enable_queue=True in launch(), upgrade Gradio to latest version.
If you want to check or upgrade Gradio version, run:
bash
pip install --upgrade gradio
and test:
python
import gradio as gr
print(gr.__version__)
If you want me to add enable_queue=True explicitly, just ask and I will provide updated code for that assuming you upgrade Gradio.
If you have the same error:
code
TypeError: Blocks.launch() got an unexpected keyword argument 'enable_queue'
but your provided script does NOT explicitly pass enable_queue, this usually means either:
There is some implicit usage or somewhere else in your environment passing enable_queue.
You might be using an old Gradio version that doesn't support .queue() or enable_queue.
Important points:
The .queue() method internally calls .launch(enable_queue=True) internally.
If your Gradio version is too old, .queue() will try to call .launch(enable_queue=True) which fails when that version of Gradio's launch() does not accept that param.
Verify Your Gradio Version
Run this in Python:
python
import gradio as gr
print(gr.__version__)
If your Gradio version is before around 3.30.0 (or so), .queue() method may not be properly supported.
Solution 1: Upgrade Gradio
You want to upgrade Gradio to a version that supports .queue() properly.
Run this in your console:
bash
pip install --upgrade gradio
or, to force reinstall:
bash
pip uninstall gradio -y
pip install gradio
Then verify the version again.
Solution 2: If you cannot upgrade, do NOT use .queue()
If for any reason you cannot upgrade Gradio, avoid .queue() completely:
Change these last lines from:
python
app.queue()
app.launch()
to:
python
app.launch()
and remove any enable_queue argument if you ever had one.
Solution 3: Explicit enable_queue=False
Sometimes, .queue() needs Gradio 3.30+, but if you must call .launch(enable_queue=True), you must upgrade.
Summary – What should you do?
Check your current Gradio version:
python
import gradio as gr
print(gr.__version__)
Upgrade Gradio:
bash
pip install --upgrade gradio
If upgrade is not possible or problem persists:
Remove .queue() call:
python
# Remove this line
# app.queue()
app.launch()
Run your app again.
Why is .queue() causing this?
.queue() enables request queuing on your Gradio app to handle multiple requests asynchronously and internally calls .launch(enable_queue=True).
Older Gradio versions don't have this feature and thus don't accept the enable_queue parameter.
Optional: If you want, send me your gradio version and your launch call, I can help you rewrite it.
Recap (minimal fix):
python
# Original last lines (causing your issue)
app.queue()
app.launch()
# Change to this if you cannot upgrade Gradio
app.launch()
Let me know what your gradio.__version__ is if the issue persists!
Since none of the previous steps fixed the issue, let's carefully troubleshoot and fix the problem step-by-step:
1. Confirm Gradio Version and Environment
Please check your Gradio version explicitly in the same environment where you run your script.
Run this small script:
python
import gradio as gr
print(gr.__version__)
Run it exactly as:
code
python version_check.py
If you have a mismatch or multiple Python environments, you may be running your script with a different environment than where you installed/checked Gradio.
2. Manually uninstall Gradio and reinstall latest stable
(For example, 3.40.1 is a recent known good stable version supporting .queue().)
Then check version again:
bash
python -c "import gradio as gr; print(gr.__version__)"
3. Modify your script launch line per version
If Gradio version is 3.30 or above, use:
python
app.queue()
app.launch()
Otherwise, if below 3.30, use:
python
app.launch()
and remove .queue()
4. Force your script to explicitly avoid or use enable_queue param
Modify your last two lines like this to test explicitly:
python
app.launch(enable_queue=False)
or just:
python
app.launch()
Do not do:
python
app.launch(enable_queue=True)
unless Gradio version ≥ 3.30
5. Full minimal launch test script
To isolate, create a new file test_gradio.py with this:
python
import gradio as gr
def greet(name):
return f"Hello {name}!"
app = gr.Interface(fn=greet, inputs="text", outputs="text", title="Test")
# Try queue or not depending on your version:
app.queue()
# or if you want to test without queue, comment the above line
app.launch()
Run it:
code
python test_gradio.py
If this runs without error, problem is elsewhere in your main script.
If this minimal script fails with the same error, the problem definitely is your gradio installation.
6. Check for accidental enable_queue=True in your code or dependencies
Search all your project files (including spaces or any other imports) for text enable_queue.
Sometimes dependencies or local modified code may inject enable_queue=True inside their .launch() calls, causing the error if your gradio version is old.
7. As a last resort, patch gradio launch call
If you suspect your environment is stuck with old Gradio, and you want to force your app working without .queue(), just remove .queue() calls:
python
# Remove this line entirely
# app.queue()
app.launch()
Full Modify of your script's launch block to try:
python
if __name__ == "__main__":
import gradio as gr
print(f"Gradio version: {gr.__version__}")
# Remove app.queue if you get errors
# app.queue()
app.launch()
Please Run this and share:
Gradio version number output
Exact command you run your script with
Confirm you installed Gradio in the same Python environment performing the run
This will help me ensure you are using compatible gradio version and environment.
If you want, I can help you create a minimal reproducible snippet (or full fix) if you share the above info from your environment.