Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,7 +98,7 @@ if "text_to_translate" not in st.session_state:
|
|
| 98 |
st.session_state.text_to_translate = ""
|
| 99 |
|
| 100 |
if "translation" not in st.session_state:
|
| 101 |
-
st.session_state.translation = "
|
| 102 |
|
| 103 |
with col_swap:
|
| 104 |
st.write("")
|
|
@@ -110,7 +110,7 @@ with col_swap:
|
|
| 110 |
|
| 111 |
with col1:
|
| 112 |
st.markdown('<h3 class="col-container">'+st.session_state.source_lang+'</h3>', unsafe_allow_html=True)
|
| 113 |
-
st.text_area(
|
| 114 |
label=" ",
|
| 115 |
value=st.session_state.text_to_translate,
|
| 116 |
height=200,
|
|
@@ -120,9 +120,9 @@ with col1:
|
|
| 120 |
|
| 121 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 122 |
if st.button("Traduire"):
|
| 123 |
-
if text_to_translate:
|
| 124 |
try:
|
| 125 |
-
response = requests.post('https://17a8-102-180-109-59.ngrok-free.app/translate/', json={"text": st.session_state.text_to_translate, "lang": st.session_state.target_lang}, timeout=
|
| 126 |
if response.status_code == 200:
|
| 127 |
translation = response.json # st.session_state.text_to_translate = " " # st.session_state.text_to_translate = " "()["translation"]
|
| 128 |
st.session_state.translation = translation
|
|
|
|
| 98 |
st.session_state.text_to_translate = ""
|
| 99 |
|
| 100 |
if "translation" not in st.session_state:
|
| 101 |
+
st.session_state.translation = ""
|
| 102 |
|
| 103 |
with col_swap:
|
| 104 |
st.write("")
|
|
|
|
| 110 |
|
| 111 |
with col1:
|
| 112 |
st.markdown('<h3 class="col-container">'+st.session_state.source_lang+'</h3>', unsafe_allow_html=True)
|
| 113 |
+
st.session_state.text_to_translate = st.text_area(
|
| 114 |
label=" ",
|
| 115 |
value=st.session_state.text_to_translate,
|
| 116 |
height=200,
|
|
|
|
| 120 |
|
| 121 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 122 |
if st.button("Traduire"):
|
| 123 |
+
if st.session_state.text_to_translate:
|
| 124 |
try:
|
| 125 |
+
response = requests.post('https://17a8-102-180-109-59.ngrok-free.app/translate/', json={"text": st.session_state.text_to_translate, "lang": st.session_state.target_lang}, timeout=600)
|
| 126 |
if response.status_code == 200:
|
| 127 |
translation = response.json # st.session_state.text_to_translate = " " # st.session_state.text_to_translate = " "()["translation"]
|
| 128 |
st.session_state.translation = translation
|