BulatF commited on
Commit
12a4176
1 Parent(s): 0f8f9a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -16,13 +16,24 @@ nltk.download('stopwords')
16
  import matplotlib.pyplot as plt
17
  import numpy as np
18
 
19
- stopwords_list = stopwords.words('english') + ['your_additional_stopwords_here']
20
 
21
- # Define the model and tokenizer
22
- model_name = 'nlptown/bert-base-multilingual-uncased-sentiment'
23
- model = AutoModelForSequenceClassification.from_pretrained(model_name)
24
- tokenizer = AutoTokenizer.from_pretrained(model_name)
25
  st.set_page_config(layout="wide")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  # Import the new model and tokenizer
28
 
 
16
  import matplotlib.pyplot as plt
17
  import numpy as np
18
 
 
19
 
20
+ stopwords_list = stopwords.words('english') + ['your_additional_stopwords_here']
 
 
 
21
  st.set_page_config(layout="wide")
22
+ @st.cache_resource
23
+ def load_model_and_tokenizer(model_name):
24
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
25
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
26
+ return model, tokenizer
27
+
28
+ model, tokenizer = load_model_and_tokenizer('nlptown/bert-base-multilingual-uncased-sentiment')
29
+
30
+ @st.cache_resource
31
+ def load_pipeline():
32
+ classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
33
+ return classifier
34
+
35
+ classifier = load_pipeline()
36
+
37
 
38
  # Import the new model and tokenizer
39