Spaces:
Build error
Build error
Thomas Chaigneau
commited on
Commit
·
9d845ba
1
Parent(s):
c36a64f
add specific file name
Browse files
main.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import re
|
|
|
2 |
import streamlit as st
|
3 |
|
4 |
from transformers import pipeline
|
@@ -15,7 +16,7 @@ st.markdown("""
|
|
15 |
""")
|
16 |
st.subheader("Translation made fast and easy.")
|
17 |
|
18 |
-
with st.expander("❓ How does it work"):
|
19 |
st.markdown("""
|
20 |
**Translator** is a **simple tool** that allows you to **translate text** from one language to another.
|
21 |
|
@@ -84,4 +85,9 @@ else:
|
|
84 |
|
85 |
st.success("🗣️ Translated!")
|
86 |
st.write(f"**Translation:** {' '.join(text_to_translate)}")
|
87 |
-
st.download_button(
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import re
|
2 |
+
import datetime
|
3 |
import streamlit as st
|
4 |
|
5 |
from transformers import pipeline
|
|
|
16 |
""")
|
17 |
st.subheader("Translation made fast and easy.")
|
18 |
|
19 |
+
with st.expander(label="❓ How does it work", expanded=True):
|
20 |
st.markdown("""
|
21 |
**Translator** is a **simple tool** that allows you to **translate text** from one language to another.
|
22 |
|
|
|
85 |
|
86 |
st.success("🗣️ Translated!")
|
87 |
st.write(f"**Translation:** {' '.join(text_to_translate)}")
|
88 |
+
st.download_button(
|
89 |
+
label="Download translated text",
|
90 |
+
data="\n".join(text_to_translate),
|
91 |
+
file_name=f"{st.session_state['input_lang']}-{st.session_state['output_lang']}-{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}.txt",
|
92 |
+
mime="text/plain"
|
93 |
+
)
|