Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
54dc6f93
Commit
54dc6f93
authored
Sep 01, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
actual support for share=True in gradio
parent
f1aa1d67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
webui.py
webui.py
+17
-6
No files found.
webui.py
View file @
54dc6f93
...
...
@@ -37,6 +37,7 @@ from contextlib import nullcontext
import
signal
import
tqdm
import
re
import
threading
import
k_diffusion.sampling
from
ldm.util
import
instantiate_from_config
...
...
@@ -75,6 +76,7 @@ cpu = torch.device("cpu")
gpu
=
torch
.
device
(
"cuda"
)
device
=
gpu
if
torch
.
cuda
.
is_available
()
else
cpu
batch_cond_uncond
=
not
(
cmd_opts
.
lowvram
or
cmd_opts
.
medvram
)
queue_lock
=
threading
.
Lock
()
if
not
cmd_opts
.
share
:
# fix gradio phoning home
...
...
@@ -643,10 +645,20 @@ def resize_image(resize_mode, im, width, height):
return
res
def
wrap_gradio_gpu_call
(
func
):
def
f
(
*
args
,
**
kwargs
):
with
queue_lock
:
res
=
func
(
*
args
,
**
kwargs
)
return
res
return
f
def
wrap_gradio_call
(
func
):
def
f
(
*
p1
,
**
p2
):
def
f
(
*
args
,
**
kwargs
):
t
=
time
.
perf_counter
()
res
=
list
(
func
(
*
p1
,
**
p2
))
res
=
list
(
func
(
*
args
,
**
kwargs
))
elapsed
=
time
.
perf_counter
()
-
t
# last item is always HTML
...
...
@@ -1259,7 +1271,7 @@ with gr.Blocks(analytics_enabled=False) as txt2img_interface:
html_info
=
gr
.
HTML
()
txt2img_args
=
dict
(
fn
=
wrap_gradio_call
(
txt2img
),
fn
=
wrap_gradio_
gpu_
call
(
txt2img
),
inputs
=
[
prompt
,
negative_prompt
,
...
...
@@ -1657,7 +1669,7 @@ with gr.Blocks(analytics_enabled=False) as img2img_interface:
)
img2img_args
=
dict
(
fn
=
wrap_gradio_call
(
img2img
),
fn
=
wrap_gradio_
gpu_
call
(
img2img
),
inputs
=
[
prompt
,
init_img
,
...
...
@@ -1736,7 +1748,7 @@ def run_extras(image, GFPGAN_strength, RealESRGAN_upscaling, RealESRGAN_model_in
extras_interface
=
gr
.
Interface
(
wrap_gradio_call
(
run_extras
),
wrap_gradio_
gpu_
call
(
run_extras
),
inputs
=
[
gr
.
Image
(
label
=
"Source"
,
source
=
"upload"
,
interactive
=
True
,
type
=
"pil"
),
gr
.
Slider
(
minimum
=
0.0
,
maximum
=
1.0
,
step
=
0.001
,
label
=
"GFPGAN strength"
,
value
=
1
,
interactive
=
have_gfpgan
),
...
...
@@ -1904,6 +1916,5 @@ def inject_gradio_html(javascript):
inject_gradio_html
(
javascript
)
demo
.
queue
(
concurrency_count
=
1
)
demo
.
launch
(
share
=
cmd_opts
.
share
)
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