peshk1n commited on
Commit
7c6a476
·
verified ·
1 Parent(s): a53d807

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -49,11 +49,11 @@ rnn_proj_dim = 512
49
  # =================================
50
 
51
  # Загрузка word_index
52
- with open('/vocabs/word_index.json', 'r', encoding='utf-8') as f:
53
  word_index = {np.str_(word): np.int64(idx) for word, idx in json.load(f).items()}
54
 
55
  # Загрузка index_word
56
- with open('/vocabs/index_word.json', 'r', encoding='utf-8') as f:
57
  index_word = {np.int64(idx): np.str_(word) for idx, word in json.load(f).items()}
58
 
59
  cls_token_id = word_index[cls_token]
@@ -493,7 +493,7 @@ _ = coca_model((dummy_features, dummy_captions))
493
  optimizer = keras.optimizers.Adam(learning_rate=1e-4)
494
  coca_model.compile(optimizer)
495
 
496
- save_dir = "/models/"
497
  model_name = "coca_007"
498
  coca_model.load_weights(f"{save_dir}/{model_name}.weights.h5")
499
 
@@ -599,7 +599,7 @@ rnn_model.compile(
599
  metrics=[Perplexity()]
600
  )
601
 
602
- save_dir = "/models/"
603
  model_name = "rnn_att_v4"
604
 
605
  rnn_model.load_weights(f"{save_dir}/{model_name}.weights.h5")
 
49
  # =================================
50
 
51
  # Загрузка word_index
52
+ with open('vocabs/word_index.json', 'r', encoding='utf-8') as f:
53
  word_index = {np.str_(word): np.int64(idx) for word, idx in json.load(f).items()}
54
 
55
  # Загрузка index_word
56
+ with open('vocabs/index_word.json', 'r', encoding='utf-8') as f:
57
  index_word = {np.int64(idx): np.str_(word) for idx, word in json.load(f).items()}
58
 
59
  cls_token_id = word_index[cls_token]
 
493
  optimizer = keras.optimizers.Adam(learning_rate=1e-4)
494
  coca_model.compile(optimizer)
495
 
496
+ save_dir = "models/"
497
  model_name = "coca_007"
498
  coca_model.load_weights(f"{save_dir}/{model_name}.weights.h5")
499
 
 
599
  metrics=[Perplexity()]
600
  )
601
 
602
+ save_dir = "models/"
603
  model_name = "rnn_att_v4"
604
 
605
  rnn_model.load_weights(f"{save_dir}/{model_name}.weights.h5")