This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcustom.html
157 lines (151 loc) · 5.14 KB
/
custom.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="css/port.css" media="screen"/>
<title>Port</title>
</head>
<body>
<div class="navbar-fixed">
<nav class="white z-depth-0">
<div class="nav-wrapper">
<div class="container">
<a class="logo black-text">port:</a>
<ul class="right">
<li><a class="waves-effect waves-light btn white black-text bordered" id="run"><span>▸</span> Run</a></li>
</ul>
</div>
</div>
</nav>
</div>
<div id="io-container" class="container" style="margin-top: 20px;">
<div class="row">
<div class="col s12" id="model"></div>
<div class="col s12 m6">
<h6>Inputs</h6>
<div class="card bordered">
<div class="card-content" id="inputs"></div>
</div>
</div>
<div class="col s12 m6">
<h6>Outputs</h6>
<div class="card bordered">
<div class="card-content" id="outputs"></div>
</div>
</div>
</div>
</div>
<div id="txt-container" class="container" style="margin-top: 20px; display: none;">
<div class="row">
<div class="col s12">
<h4>UI wrapper for functions, ML models and APIs</h4>
<p>
Port is an experimental lib based on the idea of declarative interface design.
Instead of writing front-end code, model designers and developers could focus on more important tasks specifying UI in a JSON schema.
</p>
</div>
</div>
<div class="row" style="margin-top: 50px; margin-bottom: 50px;">
<div class="col s3">
<div class="card source bordered">
<div class="card-content">
<h5>Javascript</h5>
<p>You can port regular JavaScript functions and classes</p>
</div>
</div>
</div>
<div class="col s3">
<div class="card source bordered">
<div class="card-content">
<h5>TensorFlow</h5>
<p>Import trained neural net models and run them with TensorFlow.js</p>
</div>
</div>
</div>
<div class="col s3">
<div class="card source bordered">
<div class="card-content">
<h5>SKlearn</h5>
<p>Convert trained SKlearn models to Javascript with <a href="https://github.com/nok/sklearn-porter">sklearn-porter</a></p>
</div>
</div>
</div>
<div class="col s3">
<div class="card source bordered">
<div class="card-content">
<h5>API</h5>
<p>Test how your REST API works with a simple graphical UI</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<ul class="collection">
<a href="?s=factorial" class="collection-item"><span class="badge">Javascript</span>Factorial</a>
<a href="?s=sentiment" class="collection-item"><span class="badge">Javascript</span>Sentiment analysis</a>
<a href="?s=pysummary" class="collection-item"><span class="badge">Python</span>Pandas summary</a>
</ul>
</div>
</div>
</div>
<script src="dist/materialize.min.js" type="text/javascript"></script>
<script src="dist/port.js" type="text/javascript"></script>
<script>
/*
var schema = {
model: {
url: 'http://localhost:8080/example/model.js',
container: 'array',
type: 'class',
name: 'DecisionTreeClassifier',
method: 'predict'
},
inputs: [
{
type: 'int',
name: 'alpha'
},
{
type: 'string',
name: 'beta'
},
{
type: 'categorical',
values: ['One', 'Two', 'Three'],
name: 'Test categorical'
}
],
outputs: [
{
type: 'categorical',
values: ['A', 'B', 'C', 'D']
}
]
}
*/
var params = new URLSearchParams(window.location.search)
var schema = params.get('s')
if (schema) {
if (typeof schema === 'string') {
schema = schema.includes('/') ? schema : '/port-models/' + schema + '/schema.json'
}
var port = new Port({
inputsContainer: document.getElementById('inputs'),
outputsContainer: document.getElementById('outputs'),
modelContainer: document.getElementById('model'),
schema: schema
})
document.getElementById('run').onclick = function () {
port.run()
}
} else {
document.getElementById('run').style.display = 'none'
document.getElementById('io-container').style.display = 'none'
document.getElementById('txt-container').style.display = 'block'
}
</script>
</body>
</html>