Files
embedding-buddy/src/embeddingbuddy/ui/components/sidebar.py
Austin Godber 6a995635ac
Some checks failed
Security Scan / security (pull_request) Successful in 40s
Test Suite / test (3.11) (pull_request) Successful in 1m25s
Test Suite / build (pull_request) Has been skipped
Security Scan / dependency-check (pull_request) Successful in 35s
Test Suite / lint (pull_request) Failing after 26s
remove upload success alert
2025-08-14 08:00:47 -07:00

88 lines
2.8 KiB
Python

from dash import dcc, html
import dash_bootstrap_components as dbc
from .upload import UploadComponent
class SidebarComponent:
def __init__(self):
self.upload_component = UploadComponent()
def create_layout(self):
return dbc.Col(
[
html.H5("Upload Data", className="mb-3"),
self.upload_component.create_error_alert(),
self.upload_component.create_data_upload(),
self.upload_component.create_prompts_upload(),
self.upload_component.create_reset_button(),
html.H5("Visualization Controls", className="mb-3"),
]
+ self._create_method_dropdown()
+ self._create_color_dropdown()
+ self._create_dimension_toggle()
+ self._create_prompts_toggle()
+ [
html.H5("Point Details", className="mb-3"),
html.Div(
id="point-details", children="Click on a point to see details"
),
],
width=3,
style={"padding-right": "20px"},
)
def _create_method_dropdown(self):
return [
dbc.Label("Method:"),
dcc.Dropdown(
id="method-dropdown",
options=[
{"label": "PCA", "value": "pca"},
{"label": "t-SNE", "value": "tsne"},
{"label": "UMAP", "value": "umap"},
],
value="pca",
style={"margin-bottom": "15px"},
),
]
def _create_color_dropdown(self):
return [
dbc.Label("Color by:"),
dcc.Dropdown(
id="color-dropdown",
options=[
{"label": "Category", "value": "category"},
{"label": "Subcategory", "value": "subcategory"},
{"label": "Tags", "value": "tags"},
],
value="category",
style={"margin-bottom": "15px"},
),
]
def _create_dimension_toggle(self):
return [
dbc.Label("Dimensions:"),
dcc.RadioItems(
id="dimension-toggle",
options=[
{"label": "2D", "value": "2d"},
{"label": "3D", "value": "3d"},
],
value="3d",
style={"margin-bottom": "20px"},
),
]
def _create_prompts_toggle(self):
return [
dbc.Label("Show Prompts:"),
dcc.Checklist(
id="show-prompts-toggle",
options=[{"label": "Show prompts on plot", "value": "show"}],
value=["show"],
style={"margin-bottom": "20px"},
),
]