Update app.py
Browse files
app.py
CHANGED
|
@@ -80,16 +80,20 @@ with gr.Blocks(analytics_enabled=False) as app:
|
|
| 80 |
gr.HTML("<br>")
|
| 81 |
Result = gr.Textbox(label="Resultado")
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
gr.HTML("<div><b>Copiar al Portapapeles:</b> <span id='copy_text'></span> <button class='lg secondary svelte-cmf5ev' style='font-size: small; padding: 2px; color: #808080ba; border: none; margin-left: 5px;' onclick='copyToClipboard()'>✂</button></div>")
|
| 87 |
-
|
| 88 |
# Agregar una función JavaScript para copiar al portapapeles
|
| 89 |
gr.HTML("""
|
| 90 |
<script>
|
| 91 |
function copyToClipboard() {
|
| 92 |
-
var textToCopy = document.querySelector("textarea[data-testid='
|
| 93 |
navigator.clipboard.writeText(textToCopy).then(function() {
|
| 94 |
alert('Texto copiado al portapapeles');
|
| 95 |
}).catch(function(err) {
|
|
@@ -99,11 +103,4 @@ with gr.Blocks(analytics_enabled=False) as app:
|
|
| 99 |
</script>
|
| 100 |
""")
|
| 101 |
|
| 102 |
-
Translate.click(
|
| 103 |
-
translate_text,
|
| 104 |
-
inputs=[Language, Source],
|
| 105 |
-
outputs=[Result],
|
| 106 |
-
api_name="translate",
|
| 107 |
-
)
|
| 108 |
-
|
| 109 |
app.launch(inline=True)
|
|
|
|
| 80 |
gr.HTML("<br>")
|
| 81 |
Result = gr.Textbox(label="Resultado")
|
| 82 |
|
| 83 |
+
Translate.click(
|
| 84 |
+
translate_text,
|
| 85 |
+
inputs=[Language, Source],
|
| 86 |
+
outputs=[Result],
|
| 87 |
+
api_name="translate",
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
gr.HTML("<div><b>Copiar al Portapapeles:</b> <span id='copy_text'></span> <button class='lg secondary svelte-cmf5ev' style='font-size: small; padding: 2px; color: #808080ba; border: none; margin-left: 5px;' onclick='copyToClipboard()'>✂</button></div>")
|
| 91 |
+
|
| 92 |
# Agregar una función JavaScript para copiar al portapapeles
|
| 93 |
gr.HTML("""
|
| 94 |
<script>
|
| 95 |
function copyToClipboard() {
|
| 96 |
+
var textToCopy = document.querySelector("textarea[data-testid='gr-textarea-1']").value;
|
| 97 |
navigator.clipboard.writeText(textToCopy).then(function() {
|
| 98 |
alert('Texto copiado al portapapeles');
|
| 99 |
}).catch(function(err) {
|
|
|
|
| 103 |
</script>
|
| 104 |
""")
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
app.launch(inline=True)
|