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
0afbc0c2
Commit
0afbc0c2
authored
May 29, 2023
by
Aarni Koskela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up `if "http" in ...:` to be more sensible startswiths
parent
89352a2f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
8 deletions
+8
-8
extensions-builtin/ScuNET/scripts/scunet_model.py
extensions-builtin/ScuNET/scripts/scunet_model.py
+2
-2
extensions-builtin/SwinIR/scripts/swinir_model.py
extensions-builtin/SwinIR/scripts/swinir_model.py
+2
-2
modules/esrgan_model.py
modules/esrgan_model.py
+2
-2
modules/gfpgan_model.py
modules/gfpgan_model.py
+1
-1
modules/modelloader.py
modules/modelloader.py
+1
-1
No files found.
extensions-builtin/ScuNET/scripts/scunet_model.py
View file @
0afbc0c2
...
@@ -27,7 +27,7 @@ class UpscalerScuNET(modules.upscaler.Upscaler):
...
@@ -27,7 +27,7 @@ class UpscalerScuNET(modules.upscaler.Upscaler):
scalers
=
[]
scalers
=
[]
add_model2
=
True
add_model2
=
True
for
file
in
model_paths
:
for
file
in
model_paths
:
if
"http"
in
file
:
if
file
.
startswith
(
"http"
)
:
name
=
self
.
model_name
name
=
self
.
model_name
else
:
else
:
name
=
modelloader
.
friendly_name
(
file
)
name
=
modelloader
.
friendly_name
(
file
)
...
@@ -118,7 +118,7 @@ class UpscalerScuNET(modules.upscaler.Upscaler):
...
@@ -118,7 +118,7 @@ class UpscalerScuNET(modules.upscaler.Upscaler):
def
load_model
(
self
,
path
:
str
):
def
load_model
(
self
,
path
:
str
):
device
=
devices
.
get_device_for
(
'scunet'
)
device
=
devices
.
get_device_for
(
'scunet'
)
if
"http"
in
path
:
if
path
.
startswith
(
"http"
)
:
filename
=
load_file_from_url
(
self
.
model_url
,
model_dir
=
self
.
model_download_path
,
file_name
=
f
"{self.name}.pth"
)
filename
=
load_file_from_url
(
self
.
model_url
,
model_dir
=
self
.
model_download_path
,
file_name
=
f
"{self.name}.pth"
)
else
:
else
:
filename
=
path
filename
=
path
...
...
extensions-builtin/SwinIR/scripts/swinir_model.py
View file @
0afbc0c2
...
@@ -27,7 +27,7 @@ class UpscalerSwinIR(Upscaler):
...
@@ -27,7 +27,7 @@ class UpscalerSwinIR(Upscaler):
scalers
=
[]
scalers
=
[]
model_files
=
self
.
find_models
(
ext_filter
=
[
".pt"
,
".pth"
])
model_files
=
self
.
find_models
(
ext_filter
=
[
".pt"
,
".pth"
])
for
model
in
model_files
:
for
model
in
model_files
:
if
"http"
in
model
:
if
model
.
startswith
(
"http"
)
:
name
=
self
.
model_name
name
=
self
.
model_name
else
:
else
:
name
=
modelloader
.
friendly_name
(
model
)
name
=
modelloader
.
friendly_name
(
model
)
...
@@ -48,7 +48,7 @@ class UpscalerSwinIR(Upscaler):
...
@@ -48,7 +48,7 @@ class UpscalerSwinIR(Upscaler):
return
img
return
img
def
load_model
(
self
,
path
,
scale
=
4
):
def
load_model
(
self
,
path
,
scale
=
4
):
if
"http"
in
path
:
if
path
.
startswith
(
"http"
)
:
filename
=
modelloader
.
load_file_from_url
(
filename
=
modelloader
.
load_file_from_url
(
url
=
path
,
url
=
path
,
model_dir
=
self
.
model_download_path
,
model_dir
=
self
.
model_download_path
,
...
...
modules/esrgan_model.py
View file @
0afbc0c2
...
@@ -133,7 +133,7 @@ class UpscalerESRGAN(Upscaler):
...
@@ -133,7 +133,7 @@ class UpscalerESRGAN(Upscaler):
scaler_data
=
UpscalerData
(
self
.
model_name
,
self
.
model_url
,
self
,
4
)
scaler_data
=
UpscalerData
(
self
.
model_name
,
self
.
model_url
,
self
,
4
)
scalers
.
append
(
scaler_data
)
scalers
.
append
(
scaler_data
)
for
file
in
model_paths
:
for
file
in
model_paths
:
if
"http"
in
file
:
if
file
.
startswith
(
"http"
)
:
name
=
self
.
model_name
name
=
self
.
model_name
else
:
else
:
name
=
modelloader
.
friendly_name
(
file
)
name
=
modelloader
.
friendly_name
(
file
)
...
@@ -150,7 +150,7 @@ class UpscalerESRGAN(Upscaler):
...
@@ -150,7 +150,7 @@ class UpscalerESRGAN(Upscaler):
return
img
return
img
def
load_model
(
self
,
path
:
str
):
def
load_model
(
self
,
path
:
str
):
if
"http"
in
path
:
if
path
.
startswith
(
"http"
)
:
filename
=
modelloader
.
load_file_from_url
(
filename
=
modelloader
.
load_file_from_url
(
url
=
self
.
model_url
,
url
=
self
.
model_url
,
model_dir
=
self
.
model_download_path
,
model_dir
=
self
.
model_download_path
,
...
...
modules/gfpgan_model.py
View file @
0afbc0c2
...
@@ -25,7 +25,7 @@ def gfpgann():
...
@@ -25,7 +25,7 @@ def gfpgann():
return
None
return
None
models
=
modelloader
.
load_models
(
model_path
,
model_url
,
user_path
,
ext_filter
=
"GFPGAN"
)
models
=
modelloader
.
load_models
(
model_path
,
model_url
,
user_path
,
ext_filter
=
"GFPGAN"
)
if
len
(
models
)
==
1
and
"http"
in
models
[
0
]
:
if
len
(
models
)
==
1
and
models
[
0
]
.
startswith
(
"http"
)
:
model_file
=
models
[
0
]
model_file
=
models
[
0
]
elif
len
(
models
)
!=
0
:
elif
len
(
models
)
!=
0
:
latest_file
=
max
(
models
,
key
=
os
.
path
.
getctime
)
latest_file
=
max
(
models
,
key
=
os
.
path
.
getctime
)
...
...
modules/modelloader.py
View file @
0afbc0c2
...
@@ -82,7 +82,7 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None
...
@@ -82,7 +82,7 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None
def
friendly_name
(
file
:
str
):
def
friendly_name
(
file
:
str
):
if
"http"
in
file
:
if
file
.
startswith
(
"http"
)
:
file
=
urlparse
(
file
)
.
path
file
=
urlparse
(
file
)
.
path
file
=
os
.
path
.
basename
(
file
)
file
=
os
.
path
.
basename
(
file
)
...
...
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