Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
c5334fc5
Commit
c5334fc5
authored
Nov 08, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix javascript duplication bug after pressing the restart UI button
parent
804d9fb8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
ui.py
modules/ui.py
+4
-3
No files found.
modules/ui.py
View file @
c5334fc5
...
@@ -1752,7 +1752,7 @@ def create_ui(wrap_gradio_gpu_call):
...
@@ -1752,7 +1752,7 @@ def create_ui(wrap_gradio_gpu_call):
return
demo
return
demo
def
load_javascript
(
raw_response
):
def
reload_javascript
(
):
with
open
(
os
.
path
.
join
(
script_path
,
"script.js"
),
"r"
,
encoding
=
"utf8"
)
as
jsfile
:
with
open
(
os
.
path
.
join
(
script_path
,
"script.js"
),
"r"
,
encoding
=
"utf8"
)
as
jsfile
:
javascript
=
f
'<script>{jsfile.read()}</script>'
javascript
=
f
'<script>{jsfile.read()}</script>'
...
@@ -1768,7 +1768,7 @@ def load_javascript(raw_response):
...
@@ -1768,7 +1768,7 @@ def load_javascript(raw_response):
javascript
+=
f
"
\n
<script>{localization.localization_js(shared.opts.localization)}</script>"
javascript
+=
f
"
\n
<script>{localization.localization_js(shared.opts.localization)}</script>"
def
template_response
(
*
args
,
**
kwargs
):
def
template_response
(
*
args
,
**
kwargs
):
res
=
raw_response
(
*
args
,
**
kwargs
)
res
=
shared
.
GradioTemplateResponseOriginal
(
*
args
,
**
kwargs
)
res
.
body
=
res
.
body
.
replace
(
res
.
body
=
res
.
body
.
replace
(
b
'</head>'
,
f
'{javascript}</head>'
.
encode
(
"utf8"
))
b
'</head>'
,
f
'{javascript}</head>'
.
encode
(
"utf8"
))
res
.
init_headers
()
res
.
init_headers
()
...
@@ -1777,4 +1777,5 @@ def load_javascript(raw_response):
...
@@ -1777,4 +1777,5 @@ def load_javascript(raw_response):
gradio
.
routes
.
templates
.
TemplateResponse
=
template_response
gradio
.
routes
.
templates
.
TemplateResponse
=
template_response
reload_javascript
=
partial
(
load_javascript
,
gradio
.
routes
.
templates
.
TemplateResponse
)
if
not
hasattr
(
shared
,
'GradioTemplateResponseOriginal'
):
shared
.
GradioTemplateResponseOriginal
=
gradio
.
routes
.
templates
.
TemplateResponse
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment