diff --git a/Dockerfile b/Dockerfile
index 5e33bbc..9b289dd 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get clean && apt-get update -y && apt-get upgrade -y && pip install --upgrade pip
-RUN pip3 install -U onnx flask onnxruntime
+RUN pip3 install -U onnx flask
COPY ./static /static
COPY ./templates /templates
diff --git a/app.py b/app.py
index 5155784..fad078f 100644
--- a/app.py
+++ b/app.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python3.8
-
from flask import Flask, render_template, request
from onnx_modifier import onnxModifier
app = Flask(__name__)
diff --git a/docs/todo_list.md b/docs/todo_list.md
index 86b6b12..701181b 100644
--- a/docs/todo_list.md
+++ b/docs/todo_list.md
@@ -1,13 +1,12 @@
# TODO
- support desktop application.
+- support more flexible downloading schema
+ - As this [request](https://github.com/ZhangGe6/onnx-modifier/pull/5) notes, the current downloading schema prevents `onnx-modifier ` from being deployed remotely as a service.
- support adding more complicated nodes (which has some simple parameters).
-
- support combine models.
-
- support user-defined input/output number when the type of node's input/output is list.
-
- slim the codes.
- because some `.js` files (like electron.js and even python.js) in the `static` folder and `electron.html` in `templates` folder are legacy of Netron and can be further slimmed.
diff --git a/onnx_modifier.py b/onnx_modifier.py
index c40f430..7033ae7 100644
--- a/onnx_modifier.py
+++ b/onnx_modifier.py
@@ -7,7 +7,6 @@ import os
import copy
import numpy as np
import onnx
-import onnxruntime as rt
from utils import make_new_node, make_attr_changed_node
class onnxModifier:
@@ -159,7 +158,8 @@ class onnxModifier:
# onnx.checker.check_model(self.model_proto)
onnx.save(self.model_proto, save_path)
- def inference(self, x=None, output_names=None):
+ def inference(self, x=None, output_names=None):
+ import onnxruntime as rt
if not x:
input_shape = [1, 3, 224, 224]
x = np.random.randn(*input_shape).astype(np.float32)
diff --git a/readme.md b/readme.md
index 777675f..b2952fd 100644
--- a/readme.md
+++ b/readme.md
@@ -28,7 +28,7 @@ Hope it helps!
# Getting started
-We have two methods to launch `onnx-modifier` now.
+We have three methods to launch `onnx-modifier` now.
## launch from command line
Clone the repo and install the required Python packages by
@@ -37,7 +37,7 @@ Clone the repo and install the required Python packages by
git clone git@github.com:ZhangGe6/onnx-modifier.git
cd onnx-modifier
-pip install onnx onnxruntime flask
+pip install onnx flask
```
Then run
@@ -49,15 +49,20 @@ python app.py
Click the url in the output info generated by flask (`http://127.0.0.1:5000/` for example), then `onnx-modifier` will be launched in the web browser.
## launch from executable file
+
+ Click to expand
- Windows: Download [onnx-modifier.exe (27.6MB)](https://drive.google.com/file/d/1y7mYlvF0G5iiNDgOFh1ESXlTs8I2ipVQ/view?usp=sharing), double-click it and enjoy.
- Edge browser is used for runtime environment by default.
> I recorded how I made the the executable file in `app_desktop.py`. The executable file for other platforms are left for future work.
+
+
-Click `Open Model...` to upload the ONNX model to edit. The model will be parsed and shown on the page.
## launch from a docker container
+
+ Click to expand
We create a docker container like this:
@@ -80,9 +85,14 @@ docker run -d -t \
```
Then we have access to onnx-modifer from URL . The modified ONNX models are expected to be found inside the local folder `modified_onnx`.
+
+
+Click `Open Model...` to upload the ONNX model to edit. The model will be parsed and shown on the page.
+
# Usage
+
Graph-level-operation elements are placed on the left-top of the page. Currently, there are four buttons: `Refresh`, `Reset`, `Download` and `Add node`. They can do:
- `Refresh`: Refresh the model graph to preview editing effects.