-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.jsx
46 lines (45 loc) · 1.22 KB
/
output.jsx
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
import React from 'react';
import {
Icon,
Tabs,
Pane,
Code,
} from 'watson-react-components';
export default function (prop) {
return (
<div className="output-container">
{(prop.data || prop.error) ? <h2 className="base--h2">Salida</h2> : null}
{prop.data
? (
<Tabs selected={0}>
<Pane label="Resultados">
<p>
El clasificador de lenguaje natural esta
<code className="base--code">
{Math.floor(prop.data.classes[0].confidence * 100)}
%
</code>
seguro de que se esta hablando de
<code className="base--code">{prop.data.top_class}</code>
.
</p>
</Pane>
<Pane label="JSON">
<Code language="json">
{JSON.stringify(prop.data, null, 2)}
</Code>
</Pane>
</Tabs>
) : null
}
{prop.error
? (
<div className="service-error">
<Icon type="error" />
<p className="base--p service-error--message">{prop.error}</p>
</div>
) : (null)
}
</div>
);
}