Lamp Socrates commited on
Commit
b5dd5bc
1 Parent(s): 5e27fad

fixed model

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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-base-cased-sourav")
13
- model = AutoModelForTokenClassification.from_pretrained("LampOfSocrates/bert-base-cased-sourav")
14
  # Mapping labels
15
- label_map = model.config.id2label
16
  # Print the label mapping
17
- print(label_map)
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
- 'ORG': 'lightblue',
42
- 'PER': 'lightgreen',
43
- 'LOC': 'lightcoral',
44
- 'MISC': 'lightyellow'
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