Spaces:
Sleeping
Sleeping
Add JS fallback to force close modal on HF Spaces
Browse files
app.py
CHANGED
|
@@ -320,7 +320,15 @@ with gr.Blocks(title="AnatomyBot") as demo:
|
|
| 320 |
m_btn.click(
|
| 321 |
fn=lambda n,s,y: (gr.update(visible=False), f"**Doctor {n}** | {s}", n, save_student(n,s,y)),
|
| 322 |
inputs=[m_name, m_school, m_year],
|
| 323 |
-
outputs=[modal, welcome_msg, student_name, gr.State()] # dummy output for save
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
)
|
| 325 |
|
| 326 |
# 2. Navigation (Updates the Tabs 'selected' state)
|
|
|
|
| 320 |
m_btn.click(
|
| 321 |
fn=lambda n,s,y: (gr.update(visible=False), f"**Doctor {n}** | {s}", n, save_student(n,s,y)),
|
| 322 |
inputs=[m_name, m_school, m_year],
|
| 323 |
+
outputs=[modal, welcome_msg, student_name, gr.State()], # dummy output for save
|
| 324 |
+
js="""
|
| 325 |
+
(name, school, year) => {
|
| 326 |
+
if (name && name.trim() && school && school.trim() && year) {
|
| 327 |
+
const modal = document.getElementById('registration_modal');
|
| 328 |
+
if (modal) modal.style.display = 'none';
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
"""
|
| 332 |
)
|
| 333 |
|
| 334 |
# 2. Navigation (Updates the Tabs 'selected' state)
|