Demosthene-OR commited on
Commit
fd398d9
1 Parent(s): b498339

Update sentence_similarity_tab.py

Browse files
Files changed (1) hide show
  1. tabs/sentence_similarity_tab.py +5 -4
tabs/sentence_similarity_tab.py CHANGED
@@ -374,17 +374,18 @@ def run():
374
  st.write("")
375
  st.title(tr(title))
376
  sentences = ["This is an example sentence", "Each sentence is converted"]
377
- sentences[0] = st.text_area(label=tr("Saisir le texte le texte de reference"), value="This is an example sentence")
378
- sentences[1] = st.text_area(label=tr("Saisir le texte à comparer"), value="Each sentence is converted")
379
-
380
 
381
  model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2')
382
  embeddings = model.encode(sentences)
 
383
  st.write(embeddings)
384
  st.write("")
385
  # Calculate cosine similarity between the two sentences
386
  similarity = cosine_similarity([embeddings[0]], [embeddings[1]])
387
- st.write(f"Cosine similarity: {similarity[0][0]}")
388
  st.write("")
389
  st.write("")
390
  st.write("")
 
374
  st.write("")
375
  st.title(tr(title))
376
  sentences = ["This is an example sentence", "Each sentence is converted"]
377
+ sentences[0] = st.text_area(label=tr("Saisir un élément issu de la proposition de valeur (quelque soit la langue):"), value="This is an example sentence")
378
+ sentences[1] = st.text_area(label=tr("Saisir une phrase issue de l'acte de vente (quelque soit la langue):"), value="Each sentence is converted", height=200)
379
+ st.button(label=tr("Validez"), type="primary")
380
 
381
  model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2')
382
  embeddings = model.encode(sentences)
383
+ st.write("Transformation de chaque phrase en vecteur (dimension = 384 ):")
384
  st.write(embeddings)
385
  st.write("")
386
  # Calculate cosine similarity between the two sentences
387
  similarity = cosine_similarity([embeddings[0]], [embeddings[1]])
388
+ st.write(f"Cosine similarity comprise entre 0 et 1: {similarity[0][0]}")
389
  st.write("")
390
  st.write("")
391
  st.write("")