bajrangCoder commited on
Commit
dde25fa
·
1 Parent(s): 2147340

fixed styling

Browse files
Files changed (2) hide show
  1. index.js +12 -8
  2. style.css +37 -12
index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.10.1';
2
 
3
  // Since we will download the model from the Hugging Face Hub, we can skip the local model check
4
  env.allowLocalModels = false;
@@ -7,14 +7,18 @@ env.allowLocalModels = false;
7
  const status = document.getElementById('status');
8
  const msg = document.getElementById('message');
9
  const checkMessage = document.getElementById('checkMessage');
10
- // Create a new object detection pipeline
11
  status.textContent = 'Loading model...';
12
- const classifier = await pipeline('text-classification', 'bajrangCoder/roberta_spam_onnx_quantised');
13
- //const classifier = await pipeline('text-classification', 'bajrangCoder/roberta_spam_onnx');
14
  status.textContent = 'Ready';
15
 
16
- checkMessage.onclick = async function (){
17
- status.textContent = 'Analysing...';
18
- const output = await classifier(msg.value);
19
- status.textContent = JSON.stringify(output);
 
 
 
 
 
20
  }
 
1
+ import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.17.2';
2
 
3
  // Since we will download the model from the Hugging Face Hub, we can skip the local model check
4
  env.allowLocalModels = false;
 
7
  const status = document.getElementById('status');
8
  const msg = document.getElementById('message');
9
  const checkMessage = document.getElementById('checkMessage');
10
+ // Create a new pipeline
11
  status.textContent = 'Loading model...';
12
+ const pipe = await pipeline('text-classification', 'bajrangCoder/roberta_spam_onnx');
 
13
  status.textContent = 'Ready';
14
 
15
+ checkMessage.onclick = async () => {
16
+ try{
17
+ status.textContent = 'Analysing...';
18
+ const output = await pipe(msg.value);
19
+ console.log(output)
20
+ status.textContent = JSON.stringify(output);
21
+ } catch(err) {
22
+ console.log("Error: ", err);
23
+ }
24
  }
style.css CHANGED
@@ -1,25 +1,50 @@
1
  * {
2
- box-sizing: border-box;
3
- padding: 0;
4
- margin: 0;
5
- font-family: sans-serif;
6
  }
7
 
8
  html,
9
  body {
10
- height: 100%;
11
  color: #000;
12
  background: #fff;
13
  }
14
 
15
  body {
16
- padding: 32px;
 
 
 
 
17
  }
18
 
19
- body,
20
- #container {
21
- display: flex;
22
- flex-direction: column;
23
- justify-content: center;
24
- align-items: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
 
1
  * {
2
+ box-sizing: border-box;
3
+ padding: 0;
4
+ margin: 0;
5
+ font-family: sans-serif;
6
  }
7
 
8
  html,
9
  body {
10
+ height: 100%;
11
  color: #000;
12
  background: #fff;
13
  }
14
 
15
  body {
16
+ padding: 32px;
17
+ display: flex;
18
+ flex-direction: column;
19
+ justify-content: center;
20
+ align-items: center;
21
  }
22
 
23
+ #status {
24
+ padding: 10px 12px;
25
+ background: cornsilk;
26
+ border: 2px dashed #ffdb4f;
27
+ border-radius: 8px;
28
+ font-size: 15px;
29
+ width: 100%;
30
+ text-align: center;
31
+ }
32
+
33
+ button {
34
+ padding: 10px 12px;
35
+ border-radius: 4px;
36
+ background: seagreen;
37
+ border: none;
38
+ margin: 10px 15px;
39
+ font-size: 15px;
40
+ font-weight: 600;
41
+ }
42
+
43
+ textarea {
44
+ outline: none;
45
+ font-size: 15px;
46
+ font-weight: 500;
47
+ border-radius: 6px;
48
+ padding: 10px 12px;
49
+ margin-top: 1.5rem;
50
  }