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
bfc22e45
Commit
bfc22e45
authored
Aug 16, 2022
by
Bob Bbbb
Browse files
Updated requirements and add main.py file
parent
9489fa05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
main.py
main.py
+20
-0
requirements.txt
requirements.txt
+2
-1
No files found.
main.py
0 → 100644
View file @
bfc22e45
import
os
import
torch
from
PIL
import
Image
import
numpy
as
np
from
realesrgan
import
RealESRGAN
def
main
()
->
int
:
device
=
torch
.
device
(
'cuda'
if
torch
.
cuda
.
is_available
()
else
'cpu'
)
model
=
RealESRGAN
(
device
,
scale
=
4
)
model
.
load_weights
(
'weights/RealESRGAN_x4.pth'
)
for
i
,
image
in
enumerate
(
os
.
listdir
(
"inputs"
)):
image
=
Image
.
open
(
f
"inputs/
{
image
}
"
).
convert
(
'RGB'
)
sr_image
=
model
.
predict
(
image
)
sr_image
.
save
(
f
'results/
{
i
}
.png'
)
return
1
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
requirements.txt
View file @
bfc22e45
...
...
@@ -3,4 +3,5 @@ opencv-python
Pillow
torch
>=1.7
torchvision
>=0.8.0
tqdm
\ No newline at end of file
tqdm
imageio
\ No newline at end of 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