Commit bfc22e45 authored by Bob Bbbb's avatar Bob Bbbb
Browse files

Updated requirements and add main.py file

parent 9489fa05
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
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment