Alien-Y commited on
Commit
bd1faea
·
1 Parent(s): 338417b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -35,13 +35,16 @@ else:
35
  result = model.predict(keras.preprocessing.sequence.pad_sequences(tokenizer.texts_to_sequences([question]),
36
  truncating='post', maxlen=max_len))
37
 
 
38
  idk = ['عذراً، لا يمكنني الإجابة عن السؤال المطروح', 'عذراً، لم أفهم سؤالك']
 
39
  if result[0][np.argmax(result)] < 0.65: # if perplexity is high
40
  st.write(np.random.choice(idk))
41
-
42
- tag = lbl_encoder.inverse_transform([np.argmax(result)])
43
-
44
- for i in data['intents']:
45
- if i['tag'] == tag:
46
- out = np.random.choice(i['responses'])
47
- st.write(out)
 
 
35
  result = model.predict(keras.preprocessing.sequence.pad_sequences(tokenizer.texts_to_sequences([question]),
36
  truncating='post', maxlen=max_len))
37
 
38
+
39
  idk = ['عذراً، لا يمكنني الإجابة عن السؤال المطروح', 'عذراً، لم أفهم سؤالك']
40
+
41
  if result[0][np.argmax(result)] < 0.65: # if perplexity is high
42
  st.write(np.random.choice(idk))
43
+
44
+ else:
45
+ tag = lbl_encoder.inverse_transform([np.argmax(result)])
46
+
47
+ for i in data['intents']:
48
+ if i['tag'] == tag:
49
+ out = np.random.choice(i['responses'])
50
+ st.write(out)