Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -69,9 +69,7 @@ os.system("wget https://github.com/AK391/models/raw/main/vision/super_resolution
|
|
69 |
# For example, if NVIDIA GPU is available and ORT Python package is built with CUDA, then call API as following:
|
70 |
# onnxruntime.InferenceSession(path/to/model, providers=['CUDAExecutionProvider'])
|
71 |
ort_session = onnxruntime.InferenceSession("super-resolution-10.onnx")
|
72 |
-
|
73 |
-
ort_outs = ort_session.run(None, ort_inputs)
|
74 |
-
img_out_y = ort_outs[0]
|
75 |
|
76 |
def inference(img):
|
77 |
orig_img = Image.open(img)
|
@@ -82,6 +80,11 @@ def inference(img):
|
|
82 |
|
83 |
img_4 = np.expand_dims(np.expand_dims(img_ndarray, axis=0), axis=0)
|
84 |
img_5 = img_4.astype(np.float32) / 255.0
|
|
|
|
|
|
|
|
|
|
|
85 |
img_out_y = Image.fromarray(np.uint8((img_out_y[0] * 255.0).clip(0, 255)[0]), mode='L')
|
86 |
final_img = Image.merge(
|
87 |
"YCbCr", [
|
|
|
69 |
# For example, if NVIDIA GPU is available and ORT Python package is built with CUDA, then call API as following:
|
70 |
# onnxruntime.InferenceSession(path/to/model, providers=['CUDAExecutionProvider'])
|
71 |
ort_session = onnxruntime.InferenceSession("super-resolution-10.onnx")
|
72 |
+
|
|
|
|
|
73 |
|
74 |
def inference(img):
|
75 |
orig_img = Image.open(img)
|
|
|
80 |
|
81 |
img_4 = np.expand_dims(np.expand_dims(img_ndarray, axis=0), axis=0)
|
82 |
img_5 = img_4.astype(np.float32) / 255.0
|
83 |
+
|
84 |
+
ort_inputs = {ort_session.get_inputs()[0].name: img_5}
|
85 |
+
ort_outs = ort_session.run(None, ort_inputs)
|
86 |
+
img_out_y = ort_outs[0]
|
87 |
+
|
88 |
img_out_y = Image.fromarray(np.uint8((img_out_y[0] * 255.0).clip(0, 255)[0]), mode='L')
|
89 |
final_img = Image.merge(
|
90 |
"YCbCr", [
|