johnnyfivefingers commited on
Commit
e8632b1
·
1 Parent(s): b6037a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -4,21 +4,21 @@ from sklearn.metrics.pairwise import cosine_similarity
4
 
5
  def greet(array_of_vectors):
6
  # [[0 1],[0 5]]
7
- array_of_vectors = replace("[[", "")
8
- array_of_vectors = replace("]]", "")
9
- array_of_vectors = replace("[", "")
10
- array_of_vectors = replace("]", "")
11
 
12
  cleaned = []
13
  vecs = array_of_vectors.split(",")
14
  for vec in vecs:
15
- arr = vec.split(" ")
16
- cleaned.append(arr)
17
 
18
  similarity_matrix = cosine_similarity(cleaned, cleaned)
19
  results = ''
20
  for matrix in similarity_matrix:
21
- results = results + str(matrix) + "\n"
22
 
23
 
24
  return results
 
4
 
5
  def greet(array_of_vectors):
6
  # [[0 1],[0 5]]
7
+ array_of_vectors = array_of_vectors.replace("[[", "")
8
+ array_of_vectors = array_of_vectors.replace("]]", "")
9
+ array_of_vectors = array_of_vectors.replace("[", "")
10
+ array_of_vectors = array_of_vectors.replace("]", "")
11
 
12
  cleaned = []
13
  vecs = array_of_vectors.split(",")
14
  for vec in vecs:
15
+ arr = vec.split(" ")
16
+ cleaned.append(arr)
17
 
18
  similarity_matrix = cosine_similarity(cleaned, cleaned)
19
  results = ''
20
  for matrix in similarity_matrix:
21
+ results = results + str(matrix) + "\n"
22
 
23
 
24
  return results