Narrativa commited on
Commit
8a1e56b
β€’
1 Parent(s): 4fca7ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -13,16 +13,16 @@ st.write("# Semantic News Search πŸ”πŸ“°")
13
 
14
  model = SentenceTransformer('all-MiniLM-L6-v2', device='cpu')
15
 
16
- df = pd.read_csv('data/financial-sentences.csv')
17
  sentences = df['sentences'].to_list()
18
 
19
  # check if embedding is available
20
 
21
- if exists('data/embeddings.npy'):
22
- corpus_embeddings = np.load('data/embeddings.npy')
23
  else:
24
  corpus_embeddings = model.encode(sentences, batch_size=23, show_progress_bar=False, convert_to_tensor=True)
25
- np.save('data/embeddings.npy', np.array(corpus_embeddings.cpu()))
26
 
27
 
28
  sentence = st.text_input('Enter a sentence:')
 
13
 
14
  model = SentenceTransformer('all-MiniLM-L6-v2', device='cpu')
15
 
16
+ df = pd.read_csv('financial-sentences.csv')
17
  sentences = df['sentences'].to_list()
18
 
19
  # check if embedding is available
20
 
21
+ if exists('embeddings.npy'):
22
+ corpus_embeddings = np.load('embeddings.npy')
23
  else:
24
  corpus_embeddings = model.encode(sentences, batch_size=23, show_progress_bar=False, convert_to_tensor=True)
25
+ np.save('embeddings.npy', np.array(corpus_embeddings.cpu()))
26
 
27
 
28
  sentence = st.text_input('Enter a sentence:')