ClefChen commited on
Commit
912edf0
·
verified ·
1 Parent(s): b070a6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -15,7 +15,9 @@ from timeit import default_timer as timer
15
  from typing import Tuple, Dict
16
  from sklearn.feature_extraction.text import TfidfVectorizer
17
  from spacy.lang.de.stop_words import STOP_WORDS
18
- vectorizer = TfidfVectorizer(stop_words=list(STOP_WORDS))
 
 
19
  '''
20
  import nltk
21
  from nltk.corpus import stopwords
@@ -169,9 +171,9 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
169
  #base_model = /home/henry/Desktop/ARIN_7102/download/phi-2 # gru_model # embedder = SentenceTransformer("/home/henry/Desktop/ARIN_7102/download/bge-small-en-v1.5", device="cuda")
170
  if base_model == "gru_model":
171
  # Model and transforms preparation
172
- model= RNN_model().to(device)
173
  # Load state dict
174
- model.load_state_dict(torch.load(f= 'pretrained_gru_model.pth', map_location= device))
175
  # Random greetings in list format
176
  greetings = ["hello!",'hello', 'hii !', 'hi', "hi there!", "hi there!", "heyy", 'good morning', 'good afternoon', 'good evening', "hey", "how are you", "how are you?", "how is it going", "how is it going?", "what's up?",
177
  "how are you?", "hey, how are you?", "what is popping", "good to see you!", "howdy!", "hi, nice to meet you.", "hiya!", "hi", "hi, what's new?", "hey, how's your day?", "hi, how have you been?", "greetings"]
 
15
  from typing import Tuple, Dict
16
  from sklearn.feature_extraction.text import TfidfVectorizer
17
  from spacy.lang.de.stop_words import STOP_WORDS
18
+ from model import ImprovedGRUModel
19
+ # vectorizer = TfidfVectorizer(stop_words=list(STOP_WORDS))
20
+ vectorizer= nltk_utils.vectorizer()
21
  '''
22
  import nltk
23
  from nltk.corpus import stopwords
 
171
  #base_model = /home/henry/Desktop/ARIN_7102/download/phi-2 # gru_model # embedder = SentenceTransformer("/home/henry/Desktop/ARIN_7102/download/bge-small-en-v1.5", device="cuda")
172
  if base_model == "gru_model":
173
  # Model and transforms preparation
174
+ model= ImprovedGRUModel().to(device)
175
  # Load state dict
176
+ model.load_state_dict(torch.load(f= 'gru_model.pth', map_location= device))
177
  # Random greetings in list format
178
  greetings = ["hello!",'hello', 'hii !', 'hi', "hi there!", "hi there!", "heyy", 'good morning', 'good afternoon', 'good evening', "hey", "how are you", "how are you?", "how is it going", "how is it going?", "what's up?",
179
  "how are you?", "hey, how are you?", "what is popping", "good to see you!", "howdy!", "hi, nice to meet you.", "hiya!", "hi", "hi, what's new?", "hey, how's your day?", "hi, how have you been?", "greetings"]