From a86c2794197692fe3cfab06247d0d20423e401cd Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sun, 18 Sep 2022 08:37:03 +0300 Subject: script.js split work --- modules/ui.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modules/ui.py') diff --git a/modules/ui.py b/modules/ui.py index 2f6eb307..202f4551 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -908,12 +908,17 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): with open(os.path.join(script_path, "script.js"), "r", encoding="utf8") as jsfile: - javascript = jsfile.read() + javascript = f'' + +jsdir = os.path.join(script_path, "javascript") +for filename in os.listdir(jsdir): + with open(os.path.join(jsdir, filename), "r", encoding="utf8") as jsfile: + javascript += f"\n" def template_response(*args, **kwargs): res = gradio_routes_templates_response(*args, **kwargs) - res.body = res.body.replace(b'', f''.encode("utf8")) + res.body = res.body.replace(b'', f'{javascript}'.encode("utf8")) res.init_headers() return res -- cgit v1.2.3