yuanjunchai commited on
Commit
37a2cf1
·
1 Parent(s): 6990f7c

add application files

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -57,8 +57,8 @@ def download_glove_embeddings_gdrive(model_type):
57
  word_index_temp = "word_index_dict_" + str(model_type) + "_temp.pkl"
58
  # 100d download
59
  if model_type == "100d":
60
- file1_path = hf_hub_download(repo_id='AveMujica/glove-twitter-100d', filename='embeddings_100d_temp.npy')
61
- file2_path = hf_hub_download(repo_id='AveMujica/glove-twitter-100d', filename='word_index_dict_100d_temp.pkl')
62
  print(f"File downloaded to: {file1_path}, {file2_path}")
63
  else:
64
  # Get glove embeddings from google drive
@@ -75,8 +75,12 @@ def download_glove_embeddings_gdrive(model_type):
75
 
76
  # @st.cache_data()
77
  def load_glove_embeddings_gdrive(model_type):
78
- word_index_temp = "word_index_dict_" + str(model_type) + "_temp.pkl"
79
- embeddings_temp = "embeddings_" + str(model_type) + "_temp.npy"
 
 
 
 
80
 
81
  # Load word index dictionary
82
  word_index_dict = pickle.load(open(word_index_temp, "rb"), encoding="latin")
 
57
  word_index_temp = "word_index_dict_" + str(model_type) + "_temp.pkl"
58
  # 100d download
59
  if model_type == "100d":
60
+ file1_path = hf_hub_download(repo_id='AveMujica/glove-twitter-100d', filename='embeddings_100d_temp.npy', local_dir='Data')
61
+ file2_path = hf_hub_download(repo_id='AveMujica/glove-twitter-100d', filename='word_index_dict_100d_temp.pkl', local_dir='Data')
62
  print(f"File downloaded to: {file1_path}, {file2_path}")
63
  else:
64
  # Get glove embeddings from google drive
 
75
 
76
  # @st.cache_data()
77
  def load_glove_embeddings_gdrive(model_type):
78
+ if model_type == "100d":
79
+ word_index_temp = "Data/word_index_dict_" + str(model_type) + "_temp.pkl"
80
+ embeddings_temp = "Data/embeddings_" + str(model_type) + "_temp.npy"
81
+ else:
82
+ word_index_temp = "word_index_dict_" + str(model_type) + "_temp.pkl"
83
+ embeddings_temp = "embeddings_" + str(model_type) + "_temp.npy"
84
 
85
  # Load word index dictionary
86
  word_index_dict = pickle.load(open(word_index_temp, "rb"), encoding="latin")