Update functions.py
Browse files- functions.py +9 -3
functions.py
CHANGED
@@ -29,7 +29,7 @@ margin-bottom: 2.5rem">{}</div> """
|
|
29 |
|
30 |
@st.experimental_singleton(suppress_st_warning=True)
|
31 |
def load_models():
|
32 |
-
asr_model = whisper.load_model("small")
|
33 |
#asr_pipe = pipeline("automatic-speech-recognition",model = "openai/whisper-small")
|
34 |
q_model = ORTModelForSequenceClassification.from_pretrained("nickmuchi/quantized-optimum-finbert-tone")
|
35 |
ner_model = AutoModelForTokenClassification.from_pretrained("xlm-roberta-large-finetuned-conll03-english")
|
@@ -40,8 +40,14 @@ def load_models():
|
|
40 |
ner_pipe = pipeline("ner", model=ner_model, tokenizer=ner_tokenizer, grouped_entities=True)
|
41 |
cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-12-v2')
|
42 |
|
43 |
-
return
|
|
|
|
|
|
|
|
|
44 |
|
|
|
|
|
45 |
@st.experimental_singleton(suppress_st_warning=True)
|
46 |
def load_sbert(model_name):
|
47 |
sbert = SentenceTransformer(model_name)
|
@@ -311,4 +317,4 @@ def fin_ext(text):
|
|
311 |
return make_spans(text,results)
|
312 |
|
313 |
nlp = get_spacy()
|
314 |
-
|
|
|
29 |
|
30 |
@st.experimental_singleton(suppress_st_warning=True)
|
31 |
def load_models():
|
32 |
+
#asr_model = whisper.load_model("small")
|
33 |
#asr_pipe = pipeline("automatic-speech-recognition",model = "openai/whisper-small")
|
34 |
q_model = ORTModelForSequenceClassification.from_pretrained("nickmuchi/quantized-optimum-finbert-tone")
|
35 |
ner_model = AutoModelForTokenClassification.from_pretrained("xlm-roberta-large-finetuned-conll03-english")
|
|
|
40 |
ner_pipe = pipeline("ner", model=ner_model, tokenizer=ner_tokenizer, grouped_entities=True)
|
41 |
cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-12-v2')
|
42 |
|
43 |
+
return sent_pipe, sum_pipe, ner_pipe, cross_encoder
|
44 |
+
|
45 |
+
@st.experimental_singleton(suppress_st_warning=True)
|
46 |
+
def load_asr_model(asr_model_name):
|
47 |
+
asr_model = whisper.load(asr_model_name)
|
48 |
|
49 |
+
return asr_model
|
50 |
+
|
51 |
@st.experimental_singleton(suppress_st_warning=True)
|
52 |
def load_sbert(model_name):
|
53 |
sbert = SentenceTransformer(model_name)
|
|
|
317 |
return make_spans(text,results)
|
318 |
|
319 |
nlp = get_spacy()
|
320 |
+
sent_pipe, sum_pipe, ner_pipe, cross_encoder = load_models()
|