File size: 677 Bytes
ecdf655
9ec2c07
dc5e397
 
 
ebbe9bc
dc5e397
 
 
9dbf9f0
8bab392
dc5e397
 
 
 
 
 
0c3c890
dc5e397
 
34b4cda
3b9712f
dc5e397
 
 
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
import numpy
import spaces
import gradio as gr
from PIL import Image
import upscale_image
import numpy as np

@spaces.GPU(duration=120)
def gradio_upscale(image):
    pil_image = Image.fromarray(np.uint8(image)).convert('RGB')
    return upscale_image.execute(pil_image)



if __name__ == "__main__":
    # Gradio UIの設定
    iface = gr.Interface(
        fn=gradio_upscale,
        inputs="image",
        outputs="image",
        title="Image Convert to 128x128 and  Upscale to 512x512",
        description="force convert to 128x128 image and upscale 512x512 with stable-diffusion-x4-upscaler",
    )
    # インターフェースを公開
    iface.launch(share=True)