Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import PIL
|
|
5 |
import onnx
|
6 |
import onnxruntime
|
7 |
|
8 |
-
config_file_url = hf_hub_url("Jacopo/ToonClip", filename="
|
9 |
model_file = cached_download(config_file_url)
|
10 |
|
11 |
onnx_model = onnx.load(model_file)
|
@@ -48,13 +48,13 @@ def nogan(input_img):
|
|
48 |
i = np.transpose(i, (2, 0, 1))
|
49 |
i = np.expand_dims(i, 0)
|
50 |
i = i / 255.0
|
51 |
-
|
52 |
|
53 |
ort_outs = ort_session.run([output_name], {input_name: i})
|
54 |
output = ort_outs
|
55 |
output = output[0][0]
|
56 |
|
57 |
-
|
58 |
output = output * 255.0
|
59 |
output = output.astype('uint8')
|
60 |
output = np.transpose(output, (1, 2, 0))
|
|
|
5 |
import onnx
|
6 |
import onnxruntime
|
7 |
|
8 |
+
config_file_url = hf_hub_url("Jacopo/ToonClip", filename="model.onnx")
|
9 |
model_file = cached_download(config_file_url)
|
10 |
|
11 |
onnx_model = onnx.load(model_file)
|
|
|
48 |
i = np.transpose(i, (2, 0, 1))
|
49 |
i = np.expand_dims(i, 0)
|
50 |
i = i / 255.0
|
51 |
+
i = normalize(i, (0.485, 0.456, 0.406), (0.229, 0.224, 0.225))
|
52 |
|
53 |
ort_outs = ort_session.run([output_name], {input_name: i})
|
54 |
output = ort_outs
|
55 |
output = output[0][0]
|
56 |
|
57 |
+
output = denormalize(output, (0.485, 0.456, 0.406), (0.229, 0.224, 0.225))
|
58 |
output = output * 255.0
|
59 |
output = output.astype('uint8')
|
60 |
output = np.transpose(output, (1, 2, 0))
|