Update app.py
Browse files
app.py
CHANGED
|
@@ -71,7 +71,7 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 71 |
)
|
| 72 |
|
| 73 |
with gr.Column(scale=3):
|
| 74 |
-
# --- DeepV Logo
|
| 75 |
with gr.Row(elem_id="logo-and-output-row"):
|
| 76 |
# Container for the logo to allow layered animations
|
| 77 |
gr.HTML("""
|
|
@@ -121,7 +121,12 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 121 |
inputs=[],
|
| 122 |
outputs=[run_btn, loading_state],
|
| 123 |
show_progress=False,
|
| 124 |
-
js="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
).then(
|
| 126 |
fn=generate_only,
|
| 127 |
inputs=[spec, use_rag, top_k, model_choice, api_key, temperature_tb, top_p_tb, max_new_tokens_tb],
|
|
@@ -130,7 +135,14 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 130 |
fn=hide_loading,
|
| 131 |
inputs=[],
|
| 132 |
outputs=[run_btn, loading_state],
|
| 133 |
-
js="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
)
|
| 135 |
|
| 136 |
clear_btn.click(fn=lambda: "Ready", outputs=[])
|
|
@@ -257,38 +269,6 @@ with gr.Blocks(title="DeepV for RTL (Model-Agnostic)", theme=gr.themes.Soft()) a
|
|
| 257 |
100% { background-color: #e6f2ff; }
|
| 258 |
}
|
| 259 |
"""
|
| 260 |
-
|
| 261 |
-
# --- JavaScript to trigger animations based on generation status ---
|
| 262 |
-
demo.load(
|
| 263 |
-
None,
|
| 264 |
-
None,
|
| 265 |
-
None,
|
| 266 |
-
js="""
|
| 267 |
-
function customLogoAnimation() {
|
| 268 |
-
const deepPart = document.getElementById('deep-part');
|
| 269 |
-
|
| 270 |
-
// Stage 1: DEEP hops away, V remains (triggered when generation starts)
|
| 271 |
-
window.hopDeepAway = () => {
|
| 272 |
-
if (deepPart) {
|
| 273 |
-
deepPart.classList.add('deep-hop-away');
|
| 274 |
-
}
|
| 275 |
-
};
|
| 276 |
-
|
| 277 |
-
// Stage 2: DEEP letters jump back in (triggered when generation ends)
|
| 278 |
-
window.jumpDeepBackIn = () => {
|
| 279 |
-
if (deepPart) {
|
| 280 |
-
deepPart.classList.remove('deep-hop-away');
|
| 281 |
-
// This line forces the browser to re-render, ensuring the animation resets
|
| 282 |
-
void deepPart.offsetWidth;
|
| 283 |
-
}
|
| 284 |
-
};
|
| 285 |
-
|
| 286 |
-
// Call it once on load to ensure it's in place
|
| 287 |
-
window.jumpDeepBackIn();
|
| 288 |
-
}
|
| 289 |
-
customLogoAnimation();
|
| 290 |
-
"""
|
| 291 |
-
)
|
| 292 |
|
| 293 |
|
| 294 |
if __name__ == "__main__":
|
|
|
|
| 71 |
)
|
| 72 |
|
| 73 |
with gr.Column(scale=3):
|
| 74 |
+
# --- DeepV Logo and "Output" text (Correctly configured gr.Image) ---
|
| 75 |
with gr.Row(elem_id="logo-and-output-row"):
|
| 76 |
# Container for the logo to allow layered animations
|
| 77 |
gr.HTML("""
|
|
|
|
| 121 |
inputs=[],
|
| 122 |
outputs=[run_btn, loading_state],
|
| 123 |
show_progress=False,
|
| 124 |
+
js="""
|
| 125 |
+
const deepPart = document.getElementById('deep-part');
|
| 126 |
+
if (deepPart) {
|
| 127 |
+
deepPart.classList.add('deep-hop-away');
|
| 128 |
+
}
|
| 129 |
+
""" # Call JS to start animation when button is clicked
|
| 130 |
).then(
|
| 131 |
fn=generate_only,
|
| 132 |
inputs=[spec, use_rag, top_k, model_choice, api_key, temperature_tb, top_p_tb, max_new_tokens_tb],
|
|
|
|
| 135 |
fn=hide_loading,
|
| 136 |
inputs=[],
|
| 137 |
outputs=[run_btn, loading_state],
|
| 138 |
+
js="""
|
| 139 |
+
const deepPart = document.getElementById('deep-part');
|
| 140 |
+
if (deepPart) {
|
| 141 |
+
deepPart.classList.remove('deep-hop-away');
|
| 142 |
+
// This line forces the browser to re-render, ensuring the animation resets
|
| 143 |
+
void deepPart.offsetWidth;
|
| 144 |
+
}
|
| 145 |
+
""" # Call JS to reset animation when generation finishes
|
| 146 |
)
|
| 147 |
|
| 148 |
clear_btn.click(fn=lambda: "Ready", outputs=[])
|
|
|
|
| 269 |
100% { background-color: #e6f2ff; }
|
| 270 |
}
|
| 271 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
|
| 273 |
|
| 274 |
if __name__ == "__main__":
|