Spaces:
Sleeping
Sleeping
Lamp Socrates
commited on
Commit
•
b5dd5bc
1
Parent(s):
5e27fad
fixed model
Browse files
app.py
CHANGED
@@ -9,12 +9,12 @@ st.write(x, 'squared is', x * x)
|
|
9 |
@st.cache_resource()
|
10 |
def load_trained_model():
|
11 |
|
12 |
-
tokenizer = AutoTokenizer.from_pretrained("LampOfSocrates/bert-
|
13 |
-
model = AutoModelForTokenClassification.from_pretrained("LampOfSocrates/bert-
|
14 |
# Mapping labels
|
15 |
-
|
16 |
# Print the label mapping
|
17 |
-
print(
|
18 |
|
19 |
# Load the NER model and tokenizer from Hugging Face
|
20 |
#ner_pipeline = pipeline("ner", model="dbmdz/bert-large-cased-finetuned-conll03-english")
|
@@ -38,10 +38,10 @@ def prep_page():
|
|
38 |
|
39 |
# Create a dictionary to map entity labels to colors
|
40 |
label_colors = {
|
41 |
-
'
|
42 |
-
'
|
43 |
-
'
|
44 |
-
'
|
45 |
}
|
46 |
|
47 |
# Prepare the HTML output with styled entities
|
|
|
9 |
@st.cache_resource()
|
10 |
def load_trained_model():
|
11 |
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained("LampOfSocrates/bert-cased-plodcw-sourav")
|
13 |
+
model = AutoModelForTokenClassification.from_pretrained("LampOfSocrates/bert-cased-plodcw-sourav")
|
14 |
# Mapping labels
|
15 |
+
id2label = model.config.id2label
|
16 |
# Print the label mapping
|
17 |
+
print(f"Can recognise the following labels {id2label}")
|
18 |
|
19 |
# Load the NER model and tokenizer from Hugging Face
|
20 |
#ner_pipeline = pipeline("ner", model="dbmdz/bert-large-cased-finetuned-conll03-english")
|
|
|
38 |
|
39 |
# Create a dictionary to map entity labels to colors
|
40 |
label_colors = {
|
41 |
+
'B-LF': 'lightblue',
|
42 |
+
'B-O': 'lightgreen',
|
43 |
+
'B-AC': 'lightcoral',
|
44 |
+
'I-LF': 'lightyellow'
|
45 |
}
|
46 |
|
47 |
# Prepare the HTML output with styled entities
|