shriarul5273
commited on
Commit
·
fc69df0
1
Parent(s):
da8f98f
cpu update for docker
Browse files- app.py +6 -1
- requirements.txt +2 -2
app.py
CHANGED
@@ -1,9 +1,14 @@
|
|
|
|
1 |
import onnxruntime
|
2 |
from torchvision import transforms
|
3 |
import torch
|
4 |
import torch.nn.functional as F
|
5 |
import gradio as gr
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
preprocess_img = transforms.Compose([
|
|
|
1 |
+
import multiprocessing
|
2 |
import onnxruntime
|
3 |
from torchvision import transforms
|
4 |
import torch
|
5 |
import torch.nn.functional as F
|
6 |
import gradio as gr
|
7 |
+
|
8 |
+
sess_options = onnxruntime.SessionOptions()
|
9 |
+
sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_ALL
|
10 |
+
sess_options.intra_op_num_threads = multiprocessing.cpu_count()
|
11 |
+
ort_sess = onnxruntime.InferenceSession("RFNet.onnx", sess_options=sess_options)
|
12 |
|
13 |
|
14 |
preprocess_img = transforms.Compose([
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
torch==1.12.
|
2 |
-
torchvision==0.13.
|
3 |
Pillow==9.2.0
|
4 |
gradio==3.2.0
|
5 |
onnxruntime==1.12.1
|
|
|
1 |
+
torch==1.12.0
|
2 |
+
torchvision==0.13.0
|
3 |
Pillow==9.2.0
|
4 |
gradio==3.2.0
|
5 |
onnxruntime==1.12.1
|