File size: 2,781 Bytes
418a695
 
46453c6
753158a
46453c6
 
 
a28866f
 
 
 
 
753158a
 
 
 
 
 
 
 
 
 
 
 
 
 
eece036
418a695
46453c6
 
753158a
46453c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce7db4b
 
 
 
 
 
 
 
 
 
 
 
 
46453c6
 
 
 
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
---
license: mit
datasets:
- shhossain/book-text-classifier
language:
- en
pipeline_tag: text-classification
widget:
- text: "Skye tried very hard not to look at the shattered glass that was all over the city’s paths and roads, and pretty much everywhere, really."
  example_title: "Book Text"
- text: "I am so sorry this is a day late, guys. Unfortunately, my internet was down so it was out of my control. Its still intermittent but hopefully it will be fine by next week."
  example_title: "Normal Text"
metrics:
- accuracy
model-index:
- name: shhossain/bert-tiny-book-text-classifier
  results:
  - task:
      type: text-classification
      name: Text Classification
    dataset:
      type: shhossain/book-text-classifier
      name: Book Text Classifier Dataset
      split: test        
    metrics:
      - type: accuracy
        value: 0.999128  
---
# Book Test Classifier

Classify book text (mostly fictional book)


## Model Details

### Model Description

This model is finetuned on bert-tiny for classifying book text.



- **Developed by:** [shhossain](https://github.com/shhossain)
- **Model type:** [Bert]
- **Language(s) (NLP):** [English]
- **License:** [MIT]
- **Finetuned from model [Bert-Tiny]:** [bert-tiny](https://huggingface.co/prajjwal1/bert-tiny)



## Uses


```python
from transformers import pipeline, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('prajjwal1/bert-tiny')

pipe = pipeline('text-classification', model='shhossain/bert-tiny-book-text-classifier')

book_text = """Skye tried very hard not to look at the shattered glass that was all over the city’s paths and roads, and pretty much everywhere, really. It wasn’t quite as much damage as the Hulk had apparently done under Wanda’s influence but it was pretty bad nonetheless. Pretty much the only comfort she had, small as it was, was that she probably hadn’t killed or seriously injured anyone since an earthquake and an Avengers fight at once appeared to have done wonders for keeping the streets clear.

“Where’s the truck?” she asked, raising her voice slightly so that Ultron could hear her over the wind. It was a little demeaning to be cradled in the arms of one of his units like a child but it made flying possible, and that was a lot faster than any of the other possible modes of transportation."""

pipe(book_text) # LABEL_1
>> [{'label': 'LABEL_1', 'score': 0.9998537302017212}]

normal_text = """I am so sorry this is a day late, guys. Unfortunately, my internet was down so it was out of my control. Its still intermittent but hopefully it will be fine by next week. Hopefully the fact that Skye and Pietro are back in form will help make up for it."""

pipe(normal_text) # LABEL_0
>> [{'label': 'LABEL_0', 'score': 0.9984021782875061}]
```