Deepa Shalini commited on
Commit
c7b340d
·
1 Parent(s): 6a10045

How it works drawer

Browse files
Files changed (1) hide show
  1. app.py +92 -0
app.py CHANGED
@@ -122,6 +122,87 @@ app.layout = dmc.MantineProvider(
122
  className="prompt"
123
  ),
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  # File picker and submit button row
126
  html.Div(
127
  [
@@ -380,6 +461,17 @@ app.layout = dmc.MantineProvider(
380
  )
381
  )
382
 
 
 
 
 
 
 
 
 
 
 
 
383
  # Callback for file upload
384
  @callback(
385
  Output("stored-data", "data"),
 
122
  className="prompt"
123
  ),
124
 
125
+ # How it works section
126
+ html.Div(
127
+ [
128
+ html.Span("How it works ", style={
129
+ "fontSize": "13px",
130
+ "color": "#667085",
131
+ "fontWeight": "500"
132
+ }),
133
+ html.Span("ⓘ", id="info-icon", style={
134
+ "cursor": "pointer",
135
+ "fontSize": "14px",
136
+ "color": "#6941C6",
137
+ "marginLeft": "2px"
138
+ })
139
+ ],
140
+ style={
141
+ "marginTop": "8px",
142
+ "marginBottom": "16px"
143
+ }
144
+ ),
145
+
146
+ # Drawer for How it works
147
+ dmc.Drawer(
148
+ title="How it works",
149
+ id="info-drawer",
150
+ padding="md",
151
+ size="400px",
152
+ position="right",
153
+ children=[
154
+ html.Div([
155
+ html.Ol([
156
+ html.Li([
157
+ html.Strong("Upload and review your data:"),
158
+ " Choose a CSV file containing your dataset and take a moment to explore it—understand the columns, data types, and any patterns, filters, or transformations relevant to your analysis."
159
+ ], style={"marginBottom": "16px"}),
160
+ html.Li([
161
+ html.Strong("Describe your analytical goal:"),
162
+ " Write a natural language prompt that clearly states what you want to analyze and visualize. Reference specific column names and describe how they should be used (e.g., grouping, aggregation, filtering)."
163
+ ], style={"marginBottom": "16px"}),
164
+ html.Li([
165
+ html.Strong("Refine your prompt if needed:"),
166
+ " If the output isn’t what you expected or an error occurs, adjust your prompt to be more specific or clarify assumptions. Small changes often lead to better results."
167
+ ], style={"marginBottom": "16px"}),
168
+ html.Li([
169
+ html.Strong("Review the generated code and chart:"),
170
+ " Once the visualization is generated, review the underlying code to ensure it accurately reflects your analytical intent before using or sharing the results."
171
+ ], style={"marginBottom": "16px"}),
172
+ html.Li([
173
+ html.Strong("Share or export your results:"),
174
+ " Download the visualization as an interactive HTML file to preserve interactivity, or export it as a static image for reports, presentations, or documentation."
175
+ ], style={"marginBottom": "0px"}),
176
+ ], style={
177
+ "fontSize": "13px",
178
+ "lineHeight": "1.6",
179
+ "color": "#344054",
180
+ "paddingLeft": "20px"
181
+ }),
182
+ html.Div([
183
+ html.H4("Tips for better results:", style={
184
+ "fontSize": "13px",
185
+ "fontWeight": "600",
186
+ "color": "#344054",
187
+ "marginTop": "24px",
188
+ "marginBottom": "12px"
189
+ }),
190
+ html.Ul([
191
+ html.Li("Mention specific column names from your dataset"),
192
+ html.Li("Specify colors, themes, or styling preferences"),
193
+ html.Li("Include aggregations or transformations you need"),
194
+ html.Li("Be clear about labels, titles, and legends")
195
+ ], style={
196
+ "fontSize": "12px",
197
+ "lineHeight": "1.6",
198
+ "color": "#475467",
199
+ "paddingLeft": "20px"
200
+ })
201
+ ])
202
+ ])
203
+ ]
204
+ ),
205
+
206
  # File picker and submit button row
207
  html.Div(
208
  [
 
461
  )
462
  )
463
 
464
+ # Add callback for drawer
465
+ @callback(
466
+ Output("info-drawer", "opened"),
467
+ Input("info-icon", "n_clicks"),
468
+ State("info-drawer", "opened"),
469
+ prevent_initial_call=True
470
+ )
471
+ def toggle_drawer(n_clicks, opened):
472
+ """Toggle the info drawer when the info icon is clicked."""
473
+ return not opened
474
+
475
  # Callback for file upload
476
  @callback(
477
  Output("stored-data", "data"),