Spaces:
Running
Running
Demosthene-OR
commited on
Commit
·
877d19f
1
Parent(s):
033655d
....
Browse files- assets/value_props_logo.png +0 -0
- requirements.txt +1 -0
- tabs/intro.py +6 -4
- tabs/sentence_similarity_tab.py +17 -41
assets/value_props_logo.png
CHANGED
requirements.txt
CHANGED
@@ -34,3 +34,4 @@ gTTS==2.5.1
|
|
34 |
https://files.pythonhosted.org/packages/cc/58/96aff0e5cb8b59c06232ea7e249ed902d04ec89f52636f5be06ceb0855fe/extra_streamlit_components-0.1.60-py3-none-any.whl
|
35 |
streamlit-option-menu==0.3.12
|
36 |
deep-translator==1.11.4
|
|
|
|
34 |
https://files.pythonhosted.org/packages/cc/58/96aff0e5cb8b59c06232ea7e249ed902d04ec89f52636f5be06ceb0855fe/extra_streamlit_components-0.1.60-py3-none-any.whl
|
35 |
streamlit-option-menu==0.3.12
|
36 |
deep-translator==1.11.4
|
37 |
+
sentence_transformers==3.1.1
|
tabs/intro.py
CHANGED
@@ -11,8 +11,8 @@ def run():
|
|
11 |
# TODO: choose between one of these GIFs
|
12 |
# st.image("https://dst-studio-template.s3.eu-west-3.amazonaws.com/1.gif")
|
13 |
# st.image("https://dst-studio-template.s3.eu-west-3.amazonaws.com/2.gif")
|
14 |
-
|
15 |
-
st.image("assets/tough-communication.gif",use_column_width=True)
|
16 |
|
17 |
|
18 |
# if st.session_state.Cloud == 0:
|
@@ -28,7 +28,7 @@ def run():
|
|
28 |
st.header("**"+tr("A propos")+"**")
|
29 |
st.markdown(tr(
|
30 |
"""
|
31 |
-
Cet espace a pour objectif de tester differentes briques
|
32 |
""")
|
33 |
, unsafe_allow_html=True)
|
34 |
|
@@ -36,7 +36,9 @@ def run():
|
|
36 |
'''
|
37 |
sent = \
|
38 |
"""
|
39 |
-
|
|
|
|
|
40 |
"""
|
41 |
st.markdown(tr(sent), unsafe_allow_html=True)
|
42 |
'''
|
|
|
11 |
# TODO: choose between one of these GIFs
|
12 |
# st.image("https://dst-studio-template.s3.eu-west-3.amazonaws.com/1.gif")
|
13 |
# st.image("https://dst-studio-template.s3.eu-west-3.amazonaws.com/2.gif")
|
14 |
+
st.image("https://dst-studio-template.s3.eu-west-3.amazonaws.com/3.gif")
|
15 |
+
# st.image("assets/tough-communication.gif",use_column_width=True)
|
16 |
|
17 |
|
18 |
# if st.session_state.Cloud == 0:
|
|
|
28 |
st.header("**"+tr("A propos")+"**")
|
29 |
st.markdown(tr(
|
30 |
"""
|
31 |
+
Cet espace a pour objectif de tester les differentes briques nécéssaires pour l'outils "Value Props"
|
32 |
""")
|
33 |
, unsafe_allow_html=True)
|
34 |
|
|
|
36 |
'''
|
37 |
sent = \
|
38 |
"""
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
"""
|
43 |
st.markdown(tr(sent), unsafe_allow_html=True)
|
44 |
'''
|
tabs/sentence_similarity_tab.py
CHANGED
@@ -14,12 +14,25 @@ from gensim import corpora
|
|
14 |
import networkx as nx
|
15 |
from sklearn.manifold import TSNE
|
16 |
from gensim.models import KeyedVectors
|
|
|
17 |
from translate_app import tr
|
18 |
|
19 |
-
title = "
|
20 |
-
sidebar_name = "
|
21 |
dataPath = st.session_state.DataPath
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
with contextlib.redirect_stdout(open(os.devnull, "w")):
|
24 |
nltk.download('stopwords')
|
25 |
|
@@ -135,35 +148,7 @@ def dist_frequence_mots(df_count_word):
|
|
135 |
st.pyplot(fig)
|
136 |
|
137 |
def dist_longueur_phrase(sent_len,sent_len2, lang1, lang2 ):
|
138 |
-
|
139 |
-
fig = px.histogram(sent_len, nbins=16, range_x=[3, 18],labels={'count': 'Count', 'variable': 'Nb de mots'},
|
140 |
-
color_discrete_sequence=['rgb(200, 0, 0)'], # Couleur des barres de l'histogramme
|
141 |
-
opacity=0.7)
|
142 |
-
fig.update_traces(marker=dict(color='rgb(200, 0, 0)', line=dict(color='white', width=2)), showlegend=False,)
|
143 |
-
fig.update_layout(
|
144 |
-
title={'text': 'Distribution du nb de mots/phrase', 'y':1.0, 'x':0.5, 'xanchor': 'center', 'yanchor': 'top'},
|
145 |
-
title_font=dict(size=28), # Ajuste la taille de la police du titre
|
146 |
-
xaxis_title=None,
|
147 |
-
xaxis=dict(
|
148 |
-
title_font=dict(size=30), # Ajuste la taille de la police de l'axe X
|
149 |
-
tickfont=dict(size=22),
|
150 |
-
showgrid=True, gridcolor='white'
|
151 |
-
),
|
152 |
-
yaxis_title='Count',
|
153 |
-
yaxis=dict(
|
154 |
-
title_font= dict(size=30, color='black'), # Ajuste la taille de la police de l'axe Y
|
155 |
-
title_standoff=10, # Éloigne le label de l'axe X du graphique
|
156 |
-
tickfont=dict(size=22),
|
157 |
-
showgrid=True, gridcolor='white'
|
158 |
-
),
|
159 |
-
margin=dict(l=20, r=20, t=40, b=20), # Ajustez les valeurs de 'r' pour déplacer les commandes à droite
|
160 |
-
# legend=dict(x=1, y=1), # Position de la légende à droite en haut
|
161 |
-
# width = 600
|
162 |
-
height=600, # Définir la hauteur de la figure
|
163 |
-
plot_bgcolor='rgba(220, 220, 220, 0.6)',
|
164 |
-
)
|
165 |
-
st.plotly_chart(fig, use_container_width=True)
|
166 |
-
'''
|
167 |
df = pd.DataFrame({lang1:sent_len,lang2:sent_len2})
|
168 |
sns.set()
|
169 |
fig = plt.figure() # figsize=(12, 6*row_nb)
|
@@ -175,15 +160,6 @@ def dist_longueur_phrase(sent_len,sent_len2, lang1, lang2 ):
|
|
175 |
chart.set(title=tr('Distribution du nombre de mots sur '+str(len(sent_len))+' phrase(s)'));
|
176 |
st.pyplot(fig)
|
177 |
|
178 |
-
'''
|
179 |
-
# fig = ff.create_distplot([sent_len], ['Nb de mots'],bin_size=1, colors=['rgb(200, 0, 0)'])
|
180 |
-
|
181 |
-
distribution = pd.DataFrame({'Nb mots':sent_len, 'Nb phrases':[1]*len(sent_len)})
|
182 |
-
fig = px.histogram(distribution, x='Nb mots', y='Nb phrases', marginal="box",range_x=[3, 18], nbins=16, hover_data=distribution.columns)
|
183 |
-
fig.update_layout(height=600,title={'text': 'Distribution du nb de mots/phrase', 'y':1.0, 'x':0.5, 'xanchor': 'center', 'yanchor': 'top'})
|
184 |
-
fig.update_traces(marker=dict(color='rgb(200, 0, 0)', line=dict(color='white', width=2)), showlegend=False,)
|
185 |
-
st.plotly_chart(fig, use_container_width=True)
|
186 |
-
'''
|
187 |
|
188 |
def find_color(x,min_w,max_w):
|
189 |
b_min = 0.0*(max_w-min_w)+min_w
|
@@ -401,4 +377,4 @@ def run():
|
|
401 |
)
|
402 |
st.write("")
|
403 |
proximite()
|
404 |
-
|
|
|
14 |
import networkx as nx
|
15 |
from sklearn.manifold import TSNE
|
16 |
from gensim.models import KeyedVectors
|
17 |
+
from sentence_transformers import SentenceTransformer
|
18 |
from translate_app import tr
|
19 |
|
20 |
+
title = "Sentence Similarity"
|
21 |
+
sidebar_name = "Sentence Similarity"
|
22 |
dataPath = st.session_state.DataPath
|
23 |
|
24 |
+
|
25 |
+
from sentence_transformers import SentenceTransformer
|
26 |
+
sentences = ["This is an example sentence", "Each sentence is converted"]
|
27 |
+
|
28 |
+
model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2')
|
29 |
+
embeddings = model.encode(sentences)
|
30 |
+
st.write(embeddings)
|
31 |
+
st.write("")
|
32 |
+
st.write("")
|
33 |
+
st.write("")
|
34 |
+
|
35 |
+
'''
|
36 |
with contextlib.redirect_stdout(open(os.devnull, "w")):
|
37 |
nltk.download('stopwords')
|
38 |
|
|
|
148 |
st.pyplot(fig)
|
149 |
|
150 |
def dist_longueur_phrase(sent_len,sent_len2, lang1, lang2 ):
|
151 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
df = pd.DataFrame({lang1:sent_len,lang2:sent_len2})
|
153 |
sns.set()
|
154 |
fig = plt.figure() # figsize=(12, 6*row_nb)
|
|
|
160 |
chart.set(title=tr('Distribution du nombre de mots sur '+str(len(sent_len))+' phrase(s)'));
|
161 |
st.pyplot(fig)
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
def find_color(x,min_w,max_w):
|
165 |
b_min = 0.0*(max_w-min_w)+min_w
|
|
|
377 |
)
|
378 |
st.write("")
|
379 |
proximite()
|
380 |
+
'''
|