Commit
•
f4908ff
1
Parent(s):
4fbb72d
Update modelisation_seq2seq_tab.py
Browse files
tabs/modelisation_seq2seq_tab.py
CHANGED
@@ -86,7 +86,7 @@ def display_translation3(n1, Lang,model_type):
|
|
86 |
st.write("**ref. :** "+s_trad_ref[i])
|
87 |
st.write("")
|
88 |
with placeholder:
|
89 |
-
st.write("<p style='text-align:center;background-color:red; color:white'
|
90 |
unsafe_allow_html=True)
|
91 |
|
92 |
def fetch_translation2(url):
|
@@ -112,10 +112,15 @@ def display_translation2(n1, Lang, model_type):
|
|
112 |
# Construction de l'URL avec les paramètres
|
113 |
url = f"{url_base}?lang_tgt={target}&texte={s[i]}"
|
114 |
params.append(url)
|
115 |
-
|
116 |
with Pool(n) as p:
|
117 |
# Appels parallèles à fetch_translation avec les URLs
|
118 |
responses = p.map(fetch_translation2, params)
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
for response, s_text, s_ref in zip(responses, s, s_trad_ref):
|
121 |
s_trad.append(response.json())
|
@@ -131,7 +136,7 @@ def display_translation2(n1, Lang, model_type):
|
|
131 |
score_bleu = 0
|
132 |
|
133 |
with placeholder:
|
134 |
-
st.write("<p style='text-align:center;background-color:red; color:white'
|
135 |
unsafe_allow_html=True)
|
136 |
|
137 |
|
@@ -175,7 +180,7 @@ async def display_translation1(n1, Lang, model_type):
|
|
175 |
st.write("")
|
176 |
|
177 |
with placeholder:
|
178 |
-
st.write("<p style='text-align:center;background-color:red; color:white'
|
179 |
unsafe_allow_html=True)
|
180 |
|
181 |
|
|
|
86 |
st.write("**ref. :** "+s_trad_ref[i])
|
87 |
st.write("")
|
88 |
with placeholder:
|
89 |
+
st.write("<p style='text-align:center;background-color:red; color:white'>Score Bleu = "+str(int(round(corpus_bleu(s_trad,[s_trad_ref]).score,0)))+"%</p>", \
|
90 |
unsafe_allow_html=True)
|
91 |
|
92 |
def fetch_translation2(url):
|
|
|
112 |
# Construction de l'URL avec les paramètres
|
113 |
url = f"{url_base}?lang_tgt={target}&texte={s[i]}"
|
114 |
params.append(url)
|
115 |
+
'''
|
116 |
with Pool(n) as p:
|
117 |
# Appels parallèles à fetch_translation avec les URLs
|
118 |
responses = p.map(fetch_translation2, params)
|
119 |
+
'''
|
120 |
+
|
121 |
+
with concurrent.futures.ThreadPoolExecutor() as executor:
|
122 |
+
# Appels parallèles à fetch_translation avec les URLs
|
123 |
+
responses = list(executor.map(fetch_translation2, params))
|
124 |
|
125 |
for response, s_text, s_ref in zip(responses, s, s_trad_ref):
|
126 |
s_trad.append(response.json())
|
|
|
136 |
score_bleu = 0
|
137 |
|
138 |
with placeholder:
|
139 |
+
st.write("<p style='text-align:center;background-color:red; color:white'>Score Bleu = "+str(int(round(score_bleu,0)))+"%</p>", \
|
140 |
unsafe_allow_html=True)
|
141 |
|
142 |
|
|
|
180 |
st.write("")
|
181 |
|
182 |
with placeholder:
|
183 |
+
st.write("<p style='text-align:center;background-color:red; color:white'>Score Bleu = "+str(int(round(corpus_bleu(s_trad,[s_trad_ref]).score,0)))+"%</p>", \
|
184 |
unsafe_allow_html=True)
|
185 |
|
186 |
|