Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,11 @@ import torch
|
|
2 |
from transformers import BertTokenizerFast, BertForTokenClassification
|
3 |
import gradio as gr
|
4 |
|
5 |
-
# Load tokenizer and model
|
6 |
tokenizer = BertTokenizerFast.from_pretrained('bert-base-uncased')
|
7 |
model = BertForTokenClassification.from_pretrained('maximuspowers/bias-detection-ner')
|
8 |
model.eval()
|
9 |
model.to('cuda' if torch.cuda.is_available() else 'cpu')
|
10 |
|
11 |
-
# Define label mappings
|
12 |
id2label = {
|
13 |
0: 'O',
|
14 |
1: 'B-STEREO',
|
|
|
2 |
from transformers import BertTokenizerFast, BertForTokenClassification
|
3 |
import gradio as gr
|
4 |
|
|
|
5 |
tokenizer = BertTokenizerFast.from_pretrained('bert-base-uncased')
|
6 |
model = BertForTokenClassification.from_pretrained('maximuspowers/bias-detection-ner')
|
7 |
model.eval()
|
8 |
model.to('cuda' if torch.cuda.is_available() else 'cpu')
|
9 |
|
|
|
10 |
id2label = {
|
11 |
0: 'O',
|
12 |
1: 'B-STEREO',
|