Sambhavnoobcoder commited on
Commit
66fca11
·
1 Parent(s): 217b0e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -34,10 +34,10 @@ def f1(y_true, y_pred):
34
  def accuracy(y_true, y_pred):
35
  return K.mean(K.equal(y_true, K.round(y_pred)), axis=1)
36
 
37
- with open('tokenizer.json', 'r', encoding='utf-8') as f:
38
- tokenizer_config = f.read()
39
 
40
- tokenizer = tokenizer_from_json(tokenizer_config)
41
 
42
  model = tf.keras.models.load_model("sentimentality.h5", custom_objects={'f1':f1, 'recall': recall, 'precision': precision, 'accuracy':accuracy})
43
 
@@ -50,7 +50,7 @@ def get_sentiment(text):
50
  text = text.split()
51
  text = [stemmer.lemmatize(word) for word in text]
52
  text = ' '.join(text)
53
- text = tokenizer.texts_to_sequences([text])[0]
54
  text += [0] * (30 - len(text))
55
  text = np.array(text).reshape(-1, 30)
56
  x = model.predict(text).tolist()[0][0]
 
34
  def accuracy(y_true, y_pred):
35
  return K.mean(K.equal(y_true, K.round(y_pred)), axis=1)
36
 
37
+ # with open('tokenizer.json', 'r', encoding='utf-8') as f:
38
+ # tokenizer_config = f.read()
39
 
40
+ # tokenizer = tokenizer_from_json(tokenizer_config)
41
 
42
  model = tf.keras.models.load_model("sentimentality.h5", custom_objects={'f1':f1, 'recall': recall, 'precision': precision, 'accuracy':accuracy})
43
 
 
50
  text = text.split()
51
  text = [stemmer.lemmatize(word) for word in text]
52
  text = ' '.join(text)
53
+ # text = tokenizer.texts_to_sequences([text])[0]
54
  text += [0] * (30 - len(text))
55
  text = np.array(text).reshape(-1, 30)
56
  x = model.predict(text).tolist()[0][0]