Spaces:
Runtime error
Runtime error
hacpdsae2023
commited on
Commit
·
b4b1fd9
1
Parent(s):
eef4a07
test bug fix
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
from datasets import load_dataset
|
3 |
dataset = load_dataset("roneneldan/TinyStories")
|
4 |
|
5 |
-
st.write(dataset['train'][
|
6 |
|
7 |
#-------------------------------------------------------------
|
8 |
#-------------------------------------------------------------
|
@@ -12,9 +12,10 @@ model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
12 |
|
13 |
# Sentences from the data set
|
14 |
sentences = [item['text'] for item in dataset['train'][:10]]
|
|
|
15 |
|
16 |
#Compute embedding
|
17 |
-
|
18 |
|
19 |
#Compute cosine-similarities
|
20 |
cosine_scores = util.cos_sim(embeddings, embeddings)
|
|
|
2 |
from datasets import load_dataset
|
3 |
dataset = load_dataset("roneneldan/TinyStories")
|
4 |
|
5 |
+
st.write(dataset['train'][10]['text'])
|
6 |
|
7 |
#-------------------------------------------------------------
|
8 |
#-------------------------------------------------------------
|
|
|
12 |
|
13 |
# Sentences from the data set
|
14 |
sentences = [item['text'] for item in dataset['train'][:10]]
|
15 |
+
sentences = [dataset['train'][0],dataset['train'][1],dataset['train'][2]]
|
16 |
|
17 |
#Compute embedding
|
18 |
+
embeddings = model.encode(sentences, convert_to_tensor=True)
|
19 |
|
20 |
#Compute cosine-similarities
|
21 |
cosine_scores = util.cos_sim(embeddings, embeddings)
|