Update app.py
Browse files
app.py
CHANGED
|
@@ -122,9 +122,8 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 122 |
outputs=[run_btn, loading_state],
|
| 123 |
show_progress=False,
|
| 124 |
js="""
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
deepPart.classList.add('deep-hop-away');
|
| 128 |
}
|
| 129 |
""" # Call JS to start animation when button is clicked
|
| 130 |
).then(
|
|
@@ -136,11 +135,10 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 136 |
inputs=[],
|
| 137 |
outputs=[run_btn, loading_state],
|
| 138 |
js="""
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
deepPart.classList.remove('deep-hop-away');
|
| 142 |
// This line forces the browser to re-render, ensuring the animation resets
|
| 143 |
-
void
|
| 144 |
}
|
| 145 |
""" # Call JS to reset animation when generation finishes
|
| 146 |
)
|
|
@@ -154,12 +152,14 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 154 |
outputs=[],
|
| 155 |
js="""
|
| 156 |
(text) => {
|
| 157 |
-
|
| 158 |
-
el
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
|
|
|
|
|
|
| 163 |
}
|
| 164 |
"""
|
| 165 |
)
|
|
|
|
| 122 |
outputs=[run_btn, loading_state],
|
| 123 |
show_progress=False,
|
| 124 |
js="""
|
| 125 |
+
(e) => {
|
| 126 |
+
document.getElementById('deep-part').classList.add('deep-hop-away');
|
|
|
|
| 127 |
}
|
| 128 |
""" # Call JS to start animation when button is clicked
|
| 129 |
).then(
|
|
|
|
| 135 |
inputs=[],
|
| 136 |
outputs=[run_btn, loading_state],
|
| 137 |
js="""
|
| 138 |
+
(e) => {
|
| 139 |
+
document.getElementById('deep-part').classList.remove('deep-hop-away');
|
|
|
|
| 140 |
// This line forces the browser to re-render, ensuring the animation resets
|
| 141 |
+
void document.getElementById('deep-part').offsetWidth;
|
| 142 |
}
|
| 143 |
""" # Call JS to reset animation when generation finishes
|
| 144 |
)
|
|
|
|
| 152 |
outputs=[],
|
| 153 |
js="""
|
| 154 |
(text) => {
|
| 155 |
+
// Creates and copies a temporary element without using variable declarations
|
| 156 |
+
(function(el) {
|
| 157 |
+
el.value = text;
|
| 158 |
+
document.body.appendChild(el);
|
| 159 |
+
el.select();
|
| 160 |
+
document.execCommand('copy');
|
| 161 |
+
document.body.removeChild(el);
|
| 162 |
+
})(document.createElement('textarea'));
|
| 163 |
}
|
| 164 |
"""
|
| 165 |
)
|