gladguy commited on
Commit
757771b
·
1 Parent(s): ef09325

Fix: Move CSS to launch method for HF Spaces compatibility

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -214,21 +214,23 @@ def submit_viva_answer_logic(ans, qs, idx, name):
214
  return "### 🎉 VIVA Complete!", "", "", fb, gr.update(interactive=False, value="Done"), next_idx, None
215
 
216
  # --- GRADIO UI ---
217
- with gr.Blocks(title="AnatomyBot", css="""
218
- /* HIDE DEFAULT TABS HEADER to use Custom Nav */
219
- .tabs > .tab-nav { display: none !important; }
220
-
221
- #registration_modal {
222
- position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
223
- z-index: 1000; background: white; padding: 2rem; border-radius: 20px;
224
- box-shadow: 0 10px 40px rgba(0,0,0,0.3); border: 2px solid #ff6b35; width: 80%; max-width: 600px;
225
- }
226
- body:has(#registration_modal:not([style*="display: none"]))::after {
227
- content: ''; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999;
228
- }
229
- #nav_bar { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; }
230
- #nav_bar button { flex: 1; white-space: nowrap; }
231
- """) as demo:
 
 
232
 
233
  # State
234
  student_name = gr.State("")
@@ -392,4 +394,4 @@ with gr.Blocks(title="AnatomyBot", css="""
392
  b_refresh.click(lambda: (f"Count: {len(get_all_students())}", get_all_students()), outputs=[adm_stat, tbl])
393
 
394
  if __name__ == "__main__":
395
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
214
  return "### 🎉 VIVA Complete!", "", "", fb, gr.update(interactive=False, value="Done"), next_idx, None
215
 
216
  # --- GRADIO UI ---
217
+ CSS = """
218
+ /* HIDE DEFAULT TABS HEADER to use Custom Nav */
219
+ .tabs > .tab-nav { display: none !important; }
220
+
221
+ #registration_modal {
222
+ position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
223
+ z-index: 1000; background: white; padding: 2rem; border-radius: 20px;
224
+ box-shadow: 0 10px 40px rgba(0,0,0,0.3); border: 2px solid #ff6b35; width: 80%; max-width: 600px;
225
+ }
226
+ body:has(#registration_modal:not([style*="display: none"]))::after {
227
+ content: ''; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999;
228
+ }
229
+ #nav_bar { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; }
230
+ #nav_bar button { flex: 1; white-space: nowrap; }
231
+ """
232
+
233
+ with gr.Blocks(title="AnatomyBot") as demo:
234
 
235
  # State
236
  student_name = gr.State("")
 
394
  b_refresh.click(lambda: (f"Count: {len(get_all_students())}", get_all_students()), outputs=[adm_stat, tbl])
395
 
396
  if __name__ == "__main__":
397
+ demo.launch(server_name="0.0.0.0", server_port=7860, css=CSS)