Spaces:
Runtime error
Runtime error
File size: 1,788 Bytes
27e2096 0c9aebb 92edfa4 2222162 6f39134 27e2096 5905fa1 92edfa4 5576e0b 4816634 0c9aebb 27e2096 4ca5c6c 45fce62 27e2096 04a5dfa 27e2096 cf7f0df 44e192b cf7f0df 45fce62 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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(256,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 = "<p style='text-align: center'><a href='https://arxiv.org/abs/2111.12704' target='_blank'>Investigating Tradeoffs in Real-World Video Super-Resolution</a> | <a href='https://github.com/ckkelvinchan/realbasicvsr' target='_blank'>Github Repo</a></p>"
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)
|