Update app.py
Browse files
app.py
CHANGED
|
@@ -325,15 +325,23 @@ with gr.Blocks() as demo:
|
|
| 325 |
with gr.Column():
|
| 326 |
reflection_btn = gr.Button("Generate reflection")
|
| 327 |
reflection_output = gr.Textbox(label="Reflections", lines=5)
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
|
| 338 |
fetch_btn.click(
|
| 339 |
process_webpage,
|
|
@@ -353,8 +361,7 @@ with gr.Blocks() as demo:
|
|
| 353 |
outputs=reflection_output,
|
| 354 |
)
|
| 355 |
|
| 356 |
-
demo.launch(share=True
|
| 357 |
-
|
| 358 |
|
| 359 |
-
# In[ ]:
|
| 360 |
|
|
|
|
|
|
| 325 |
with gr.Column():
|
| 326 |
reflection_btn = gr.Button("Generate reflection")
|
| 327 |
reflection_output = gr.Textbox(label="Reflections", lines=5)
|
| 328 |
+
# Custom HTML and JS for copy-to-clipboard
|
| 329 |
+
custom_js = """
|
| 330 |
+
<script>
|
| 331 |
+
function copyToClipboard() {
|
| 332 |
+
const textbox = document.querySelector("textarea[aria-label='Reflections']");
|
| 333 |
+
if (textbox) {
|
| 334 |
+
navigator.clipboard.writeText(textbox.value).then(() => {
|
| 335 |
+
alert("Text copied to clipboard!");
|
| 336 |
+
}).catch(err => {
|
| 337 |
+
alert("Failed to copy text: " + err);
|
| 338 |
+
});
|
| 339 |
+
}
|
| 340 |
+
}
|
| 341 |
+
</script>
|
| 342 |
+
<button onclick="copyToClipboard()">Copy to clipboard</button>
|
| 343 |
+
"""
|
| 344 |
+
gr.HTML(custom_js)
|
| 345 |
|
| 346 |
fetch_btn.click(
|
| 347 |
process_webpage,
|
|
|
|
| 361 |
outputs=reflection_output,
|
| 362 |
)
|
| 363 |
|
| 364 |
+
demo.launch(share=True)
|
|
|
|
| 365 |
|
|
|
|
| 366 |
|
| 367 |
+
# In[ ]:
|