Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
from upcunet_v3 import RealWaifuUpScaler
|
3 |
+
import traceback
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
|
7 |
+
def greet(input_img):
|
8 |
+
print(input_img.shape)
|
9 |
+
result = upscaler(input_img, tile_mode=2)
|
10 |
+
print(result.shape)
|
11 |
+
return result
|
12 |
+
|
13 |
+
|
14 |
+
if __name__ == '__main__':
|
15 |
+
ModelPath = "weights_v3/"
|
16 |
+
ModelName = "up2x-latest-no-denoise.pth"
|
17 |
+
upscaler = RealWaifuUpScaler(2, ModelPath + ModelName, half=False, device="cpu")
|
18 |
+
|
19 |
+
inputs = gr.inputs.Image()
|
20 |
+
outputs = "image"
|
21 |
+
iface = gr.Interface(fn=greet, inputs=inputs, outputs=outputs)
|
22 |
+
iface.launch()
|