Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
Real-ESRGAN
Commits
a9a671cb
Unverified
Commit
a9a671cb
authored
Dec 22, 2023
by
Maksim Skobeev
Committed by
GitHub
Dec 22, 2023
Browse files
replace to hf_hub_download
parent
362a0316
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
RealESRGAN/model.py
RealESRGAN/model.py
+3
-3
No files found.
RealESRGAN/model.py
View file @
a9a671cb
...
...
@@ -4,7 +4,7 @@ from torch.nn import functional as F
from
PIL
import
Image
import
numpy
as
np
import
cv2
from
huggingface_hub
import
hf_hub_url
,
cached
_download
from
huggingface_hub
import
hf_hub_url
,
hf_hub
_download
from
.rrdbnet_arch
import
RRDBNet
from
.utils
import
pad_reflect
,
split_image_into_overlapping_patches
,
stich_together
,
\
...
...
@@ -43,7 +43,7 @@ class RealESRGAN:
cache_dir
=
os
.
path
.
dirname
(
model_path
)
local_filename
=
os
.
path
.
basename
(
model_path
)
config_file_url
=
hf_hub_url
(
repo_id
=
config
[
'repo_id'
],
filename
=
config
[
'filename'
])
cached
_download
(
config_file_url
,
cache_dir
=
cache_dir
,
force_filename
=
local_filename
)
hf_hub
_download
(
repo_id
=
config
[
'repo_id'
]
,
cache_dir
=
cache_dir
,
force_filename
=
local_filename
)
print
(
'Weights downloaded to:'
,
os
.
path
.
join
(
cache_dir
,
local_filename
))
loadnet
=
torch
.
load
(
model_path
)
...
...
@@ -87,4 +87,4 @@ class RealESRGAN:
sr_img
=
unpad_image
(
sr_img
,
pad_size
*
scale
)
sr_img
=
Image
.
fromarray
(
sr_img
)
return
sr_img
\ No newline at end of file
return
sr_img
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