Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,14 +67,18 @@ def visualize_knn(n_neighbors):
|
|
| 67 |
return temp_file.name, f"Accuracy: {acc:.4f}"
|
| 68 |
|
| 69 |
|
|
|
|
| 70 |
custom_css = """
|
| 71 |
-
.gr-button {
|
| 72 |
background-color: #007bff !important;
|
| 73 |
color: white !important;
|
| 74 |
border-radius: 8px !important;
|
| 75 |
padding: 12px 20px !important;
|
| 76 |
font-weight: bold !important;
|
| 77 |
}
|
|
|
|
|
|
|
|
|
|
| 78 |
.gr-slider input {
|
| 79 |
accent-color: #007bff !important;
|
| 80 |
}
|
|
@@ -87,7 +91,9 @@ body, .gradio-container {
|
|
| 87 |
}
|
| 88 |
"""
|
| 89 |
|
| 90 |
-
|
|
|
|
|
|
|
| 91 |
|
| 92 |
gr.Markdown("## 🧠 KNN Decision Boundary + Dynamic Train/Test Split Visualizer")
|
| 93 |
|
|
@@ -108,4 +114,4 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 108 |
visualize_btn.click(visualize_knn, inputs=[k_slider], outputs=[output_img, accuracy_text])
|
| 109 |
|
| 110 |
|
| 111 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 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 |
}
|
|
|
|
| 91 |
}
|
| 92 |
"""
|
| 93 |
|
| 94 |
+
|
| 95 |
+
# -------------------- GRADIO UI --------------------
|
| 96 |
+
with gr.Blocks() as demo:
|
| 97 |
|
| 98 |
gr.Markdown("## 🧠 KNN Decision Boundary + Dynamic Train/Test Split Visualizer")
|
| 99 |
|
|
|
|
| 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)
|