selva1909 commited on
Commit
8a5f326
·
verified ·
1 Parent(s): 0a41a24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -67,18 +67,15 @@ def visualize_knn(n_neighbors):
67
  return temp_file.name, f"Accuracy: {acc:.4f}"
68
 
69
 
70
- # -------- CSS FIX (Gradio 6 requires CSS in launch()) ------
71
  custom_css = """
72
- button, .gr-button, .gr-button-primary, .gr-btn {
73
  background-color: #007bff !important;
74
  color: white !important;
75
  border-radius: 8px !important;
76
  padding: 12px 20px !important;
77
  font-weight: bold !important;
78
  }
79
- button:hover {
80
- background-color: #0056cc !important;
81
- }
82
  .gr-slider input {
83
  accent-color: #007bff !important;
84
  }
@@ -93,9 +90,9 @@ body, .gradio-container {
93
 
94
 
95
  # -------------------- GRADIO UI --------------------
96
- with gr.Blocks() as demo:
97
 
98
- gr.Markdown("## 🧠 KNN Decision Boundary + Dynamic Train/Test Split Visualizer")
99
 
100
  with gr.Row():
101
  with gr.Column(scale=1):
@@ -114,4 +111,5 @@ with gr.Blocks() as demo:
114
  visualize_btn.click(visualize_knn, inputs=[k_slider], outputs=[output_img, accuracy_text])
115
 
116
 
 
117
  demo.launch(server_name="0.0.0.0", server_port=7860, css=custom_css)
 
67
  return temp_file.name, f"Accuracy: {acc:.4f}"
68
 
69
 
70
+ # -------------------- CUSTOM CSS (unchanged UI COLORS) --------------------
71
  custom_css = """
72
+ .gr-button {
73
  background-color: #007bff !important;
74
  color: white !important;
75
  border-radius: 8px !important;
76
  padding: 12px 20px !important;
77
  font-weight: bold !important;
78
  }
 
 
 
79
  .gr-slider input {
80
  accent-color: #007bff !important;
81
  }
 
90
 
91
 
92
  # -------------------- GRADIO UI --------------------
93
+ with gr.Blocks() as demo: # FIX: removed css from here
94
 
95
+ gr.Markdown("## 🧠 KNN Decision Boundary + Dynamic Train/Test Split + Visualizer")
96
 
97
  with gr.Row():
98
  with gr.Column(scale=1):
 
111
  visualize_btn.click(visualize_knn, inputs=[k_slider], outputs=[output_img, accuracy_text])
112
 
113
 
114
+ # FIX: Move CSS to launch() to avoid warning
115
  demo.launch(server_name="0.0.0.0", server_port=7860, css=custom_css)