Spaces:
Paused
Paused
Doron Adler
commited on
Commit
•
69f6a0e
1
Parent(s):
0b40ce6
set both inter_op_num_threads, intra_op_num_threads as 1
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import os
|
2 |
os.system("pip install --upgrade pip")
|
3 |
-
os.system("pip install dlib")
|
4 |
import onnxruntime as rt
|
5 |
import sys
|
6 |
import PIL
|
@@ -11,17 +10,20 @@ import collections
|
|
11 |
from typing import Union, List
|
12 |
import scipy.ndimage
|
13 |
import requests
|
14 |
-
import face_detection
|
15 |
|
16 |
MODEL_FILE = "comics-heroes_p2s2p_model_from_scripted-simp.quant.onnx"
|
17 |
so = rt.SessionOptions()
|
18 |
so.inter_op_num_threads = 1
|
|
|
19 |
session = rt.InferenceSession(MODEL_FILE, sess_options=so)
|
20 |
input_name = session.get_inputs()[0].name
|
21 |
print("input_name = " + str(input_name))
|
22 |
output_name = session.get_outputs()[0].name
|
23 |
print("output_name = " + str(output_name))
|
24 |
|
|
|
|
|
|
|
25 |
def array_to_image(array_in):
|
26 |
array_in = np.squeeze(255*(array_in + 1)/2)
|
27 |
array_in = np.transpose(array_in, (1, 2, 0))
|
|
|
1 |
import os
|
2 |
os.system("pip install --upgrade pip")
|
|
|
3 |
import onnxruntime as rt
|
4 |
import sys
|
5 |
import PIL
|
|
|
10 |
from typing import Union, List
|
11 |
import scipy.ndimage
|
12 |
import requests
|
|
|
13 |
|
14 |
MODEL_FILE = "comics-heroes_p2s2p_model_from_scripted-simp.quant.onnx"
|
15 |
so = rt.SessionOptions()
|
16 |
so.inter_op_num_threads = 1
|
17 |
+
so.intra_op_num_threads = 1
|
18 |
session = rt.InferenceSession(MODEL_FILE, sess_options=so)
|
19 |
input_name = session.get_inputs()[0].name
|
20 |
print("input_name = " + str(input_name))
|
21 |
output_name = session.get_outputs()[0].name
|
22 |
print("output_name = " + str(output_name))
|
23 |
|
24 |
+
os.system("pip install dlib")
|
25 |
+
import face_detection
|
26 |
+
|
27 |
def array_to_image(array_in):
|
28 |
array_in = np.squeeze(255*(array_in + 1)/2)
|
29 |
array_in = np.transpose(array_in, (1, 2, 0))
|