Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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('
|
17 |
sentences = df['sentences'].to_list()
|
18 |
|
19 |
# check if embedding is available
|
20 |
|
21 |
-
if exists('
|
22 |
-
corpus_embeddings = np.load('
|
23 |
else:
|
24 |
corpus_embeddings = model.encode(sentences, batch_size=23, show_progress_bar=False, convert_to_tensor=True)
|
25 |
-
np.save('
|
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:')
|