import gradio as gr import spaces from gradio_imageslider import ImageSlider from image_gen_aux import UpscaleWithModel from image_gen_aux.utils import load_image MODELS = { "UltraSharp": "Kim2091/UltraSharp", "DAT X4": "OzzyGT/DAT_X4", "DAT X3": "OzzyGT/DAT_X3", "DAT X2": "OzzyGT/DAT_X2", "RealPLKSR X4": "OzzyGT/4xNomosWebPhoto_RealPLKSR", "DAT-2 RealWebPhoto X4": "Phips/4xRealWebPhoto_v4_dat2", "4xRemacri": "OzzyGT/4xRemacri", } @spaces.GPU def upscale_image(image, model_selection): original = load_image(image) upscaler = UpscaleWithModel.from_pretrained(MODELS[model_selection]).to("cuda") image = upscaler(original, tiling=True, tile_width=1024, tile_height=1024) return original, image def clear_result(): return gr.update(value=None) title = """