265 | {this.state.status === 'empty' && (
266 |
270 | )}
271 | {['training', 'uploading', 'parsing'].includes(this.state.status) && (
272 |
275 | )}
276 | {this.state.status === 'trained' && this.state.images && (
277 |
287 | )}
288 |
289 | );
290 | }
291 | }
292 |
293 | export default MLClassifierUI;
294 |
--------------------------------------------------------------------------------
/src/App/styles.scss:
--------------------------------------------------------------------------------
1 | .classifier {
2 | max-width: 300px;
3 | width: 300px;
4 | background: white;
5 | height: 300px;
6 |
7 | h1,h2,h3,h4,h5,h6 {
8 | font-weight: inherit;
9 | }
10 |
11 | button {
12 | cursor: pointer;
13 | }
14 |
15 | ul, li {
16 | list-style: none;
17 | margin: 0;
18 | padding: 0;
19 | }
20 |
21 | * {
22 | box-sizing: border-box;
23 | }
24 |
25 | a, button {
26 | cursor: pointer;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Dropzone/getFile.ts:
--------------------------------------------------------------------------------
1 | const getFile = async (item: any, path: string) => new Promise(resolve => {
2 | item.file((file: any) => {
3 | const reader = new FileReader();
4 | reader.onload = (e: any) => {
5 | return resolve({
6 | file,
7 | src: e.target.result,
8 | path: path.split('/').join(''),
9 | });
10 | };
11 | reader.readAsDataURL(file);
12 | });
13 | });
14 |
15 | export default getFile;
16 |
--------------------------------------------------------------------------------
/src/Dropzone/index.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import classNames from 'utils/classNames';
3 | import transformFiles from './transformFiles';
4 | import styles from './styles.scss';
5 |
6 | interface IProps {
7 | onDrop?: Function;
8 | onParseFiles: Function;
9 | style?: any;
10 | children?: any;
11 | }
12 |
13 | interface IState {
14 | over: boolean;
15 | }
16 |
17 | class Dropzone extends React.Component