tx3bas commited on
Commit
d97f962
verified
1 Parent(s): c2cfdef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -83,22 +83,22 @@ def main():
83
  st.write(translated_text)
84
 
85
  # Mostrar el bot贸n de copiar
86
- copy_button = """
87
  <button onclick="copyToClipboard()">Copiar</button>
88
  <script>
89
- function copyToClipboard() {
90
- var text = `{}`;
91
- navigator.clipboard.writeText(text).then(function() {
92
  alert('Texto copiado al portapapeles');
93
- }, function(err) {
94
  console.error('No se pudo copiar el texto: ', err);
95
- });
96
- }
97
  </script>
98
- """.format(translated_text.replace("\n", "\\n").replace("'", "\\'"))
99
  st.markdown(copy_button, unsafe_allow_html=True)
100
 
101
  if "translated_text" not in st.session_state:
102
  st.session_state.translated_text = ""
103
 
104
- main()
 
83
  st.write(translated_text)
84
 
85
  # Mostrar el bot贸n de copiar
86
+ copy_button = f"""
87
  <button onclick="copyToClipboard()">Copiar</button>
88
  <script>
89
+ function copyToClipboard() {{
90
+ var text = `{translated_text.replace("\n", "\\n").replace("'", "\\'")}`;
91
+ navigator.clipboard.writeText(text).then(function() {{
92
  alert('Texto copiado al portapapeles');
93
+ }}, function(err) {{
94
  console.error('No se pudo copiar el texto: ', err);
95
+ }});
96
+ }}
97
  </script>
98
+ """
99
  st.markdown(copy_button, unsafe_allow_html=True)
100
 
101
  if "translated_text" not in st.session_state:
102
  st.session_state.translated_text = ""
103
 
104
+ main()