diff --git a/modules/ui.py b/modules/ui.py
index 6b5dfd61f9d148e17989cde4584953c83b949b54..c56323f10722148e8bb87a97fa7fecb0ecda46be 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -1686,11 +1686,11 @@ def reload_javascript():
if cmd_opts.theme is not None:
inline += f"set_theme('{cmd_opts.theme}');"
- head += f'\n'
-
for script in modules.scripts.list_scripts("javascript", ".js"):
head += f'\n'
+ head += f'\n'
+
def template_response(*args, **kwargs):
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
res.body = res.body.replace(b'', f'{head}'.encode("utf8"))