import os import sys os.system("pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.10/index.html") os.system("pip install mmedit") os.system("git clone https://github.com/ckkelvinchan/RealBasicVSR.git") os.chdir("RealBasicVSR") os.system("wget https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/800px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg -O mona.jpg") import gradio as gr os.system("wget https://huggingface.co/akhaliq/RealBasicVSR_x4/resolve/main/RealBasicVSR_x4.pth") sys.path.append("RealBasicVSR") os.mkdir("test") from PIL import Image def resize(width,img): basewidth = width wpercent = (basewidth/float(img.size[0])) hsize = int((float(img.size[1])*float(wpercent))) img = img.resize((basewidth,hsize), Image.ANTIALIAS) return img def inference(img): img = resize(128,img) img.save("test/test.png") os.system("python inference_realbasicvsr.py configs/realbasicvsr_x4.py RealBasicVSR_x4.pth test/ results/demo_000") return "results/demo_000/test.png" title="RealBasicVSR" description="Gradio demo for Investigating Tradeoffs in Real-World Video Super-Resolution. To use it, simply upload your image or click on one of the examples to load them. Read more at the links below." article = "

Investigating Tradeoffs in Real-World Video Super-Resolution | Github Repo

" examples=[['mona.jpg']] gr.Interface(inference,gr.inputs.Image(type="pil"),gr.outputs.Image(type="file"),title=title,description=description,article=article,examples=examples).launch(enable_queue=True)