saicharan1234 commited on
Commit
d313ac6
·
1 Parent(s): 9de38e7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -2
main.py CHANGED
@@ -51,11 +51,12 @@ async def calculate_cosine_similarity_tabulated(data: ListInput):
51
 
52
  # Iterate through the sentences and calculate similarity scores
53
  for i, sentence1 in enumerate(embeddings1):
54
- row = ["S" + str(i + 1)] # Start the row with "S1", "S2", ...
55
 
56
  for sentence2 in embeddings2:
57
  score = util.pytorch_cos_sim(sentence1, sentence2).item()
58
- formatted_score = f"{score:.3f}"
 
59
  row.append(formatted_score)
60
 
61
  # Add the row to the similarity table
 
51
 
52
  # Iterate through the sentences and calculate similarity scores
53
  for i, sentence1 in enumerate(embeddings1):
54
+ row = ["CO" + str(i + 1)] # Start the row with "S1", "S2", ...
55
 
56
  for sentence2 in embeddings2:
57
  score = util.pytorch_cos_sim(sentence1, sentence2).item()
58
+ new_max = 3
59
+ formatted_score = f"{(score + 1) / 2 * new_max:.3f}"
60
  row.append(formatted_score)
61
 
62
  # Add the row to the similarity table