marcelomoreno26 commited on
Commit
620df1b
1 Parent(s): d9a7c31

Update model_functions.py

Browse files
Files changed (1) hide show
  1. model_functions.py +4 -1
model_functions.py CHANGED
@@ -3,16 +3,18 @@ from transformers import (AutoModelForSequenceClassification, AutoModelForSeq2Se
3
  AutoConfig, AutoModelForTokenClassification,
4
  AutoTokenizer, pipeline)
5
  from peft import PeftModel, PeftConfig
 
6
 
7
 
8
 
9
-
10
  def load_sentiment_analyzer():
11
  tokenizer = AutoTokenizer.from_pretrained("aliciiavs/sentiment-analysis-whatsapp2")
12
  model = AutoModelForSequenceClassification.from_pretrained("aliciiavs/sentiment-analysis-whatsapp2")
13
 
14
  return tokenizer, model
15
 
 
16
  def load_summarizer():
17
  config = PeftConfig.from_pretrained("marcelomoreno26/bart-large-samsum-adapter")
18
  model = AutoModelForSeq2SeqLM.from_pretrained("facebook/bart-large")
@@ -23,6 +25,7 @@ def load_summarizer():
23
 
24
  return tokenizer, model
25
 
 
26
  def load_NER():
27
  config = AutoConfig.from_pretrained("hannahisrael03/wikineural-multilingual-ner-finetuned-wikiann")
28
  model = AutoModelForTokenClassification.from_pretrained("hannahisrael03/wikineural-multilingual-ner-finetuned-wikiann",config=config)
 
3
  AutoConfig, AutoModelForTokenClassification,
4
  AutoTokenizer, pipeline)
5
  from peft import PeftModel, PeftConfig
6
+ import streamlit as st
7
 
8
 
9
 
10
+ @st.cache(show_spinner=False)
11
  def load_sentiment_analyzer():
12
  tokenizer = AutoTokenizer.from_pretrained("aliciiavs/sentiment-analysis-whatsapp2")
13
  model = AutoModelForSequenceClassification.from_pretrained("aliciiavs/sentiment-analysis-whatsapp2")
14
 
15
  return tokenizer, model
16
 
17
+ @st.cache(show_spinner=False)
18
  def load_summarizer():
19
  config = PeftConfig.from_pretrained("marcelomoreno26/bart-large-samsum-adapter")
20
  model = AutoModelForSeq2SeqLM.from_pretrained("facebook/bart-large")
 
25
 
26
  return tokenizer, model
27
 
28
+ @st.cache(show_spinner=False)
29
  def load_NER():
30
  config = AutoConfig.from_pretrained("hannahisrael03/wikineural-multilingual-ner-finetuned-wikiann")
31
  model = AutoModelForTokenClassification.from_pretrained("hannahisrael03/wikineural-multilingual-ner-finetuned-wikiann",config=config)