colesr Claude Opus 4.7 (1M context) commited on
Commit
41cf14d
·
1 Parent(s): 4138d50

Revamp UI: minimalist slate theme + subtle motion

Browse files

Adds a custom Gradio theme (Inter/JetBrains Mono, neutral slate
palette, soft focus rings) and CSS for a refined hero, animated tab
underline, micro-lift buttons, and gentle page/tab fade-ins. Logic,
components, and event wiring are unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +302 -8
app.py CHANGED
@@ -7,6 +7,291 @@ import json
7
  from datetime import datetime
8
  import re
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  def analyze_data_quality(df, columns=None):
11
  """Comprehensive data quality analysis"""
12
  if df is None or df.empty:
@@ -375,9 +660,17 @@ def get_completion_suggestions(text, columns, rule_types=["null", "unique", "ran
375
 
376
  def create_demo():
377
  """Create the main Gradio application"""
378
- with gr.Blocks() as demo:
379
- gr.Markdown("# 📊 Data Integrity & Quality Analyst Workbench")
380
- gr.Markdown("An all-in-one solution for data quality, data integrity and data validation, all powered by AI")
 
 
 
 
 
 
 
 
381
 
382
  # Store data globally
383
  data_state = gr.State(value=None)
@@ -486,10 +779,11 @@ def create_demo():
486
  gr.Markdown("💡 **Tip**: Type your rules with real-time suggestions. Format: `column:rule_type:param`")
487
 
488
  rules_input = gr.Textbox(
489
- label="Rules (format: column:rule_type:param)",
490
  placeholder="id:unique, price:range:0,1000, email:null",
491
  lines=8,
492
- info="Enter validation rules separated by commas. Use tab for autocomplete suggestions."
 
493
  )
494
 
495
  # Hidden component to store current column list for suggestions
@@ -509,10 +803,11 @@ def create_demo():
509
 
510
  gr.Markdown("### Data Cleaning Operations")
511
  cleaning_ops = gr.Textbox(
512
- label="Cleaning Operations (format: column:operation)",
513
  placeholder="name:lowercase, price:fill_mean, description:trim",
514
  lines=5,
515
- info="Enter cleaning operations separated by commas. Format: column:operation"
 
516
  )
517
  clean_btn = gr.Button("🧹 Clean Data", variant="secondary")
518
  download_clean_btn = gr.Button("💾 Download Cleaned Data", variant="secondary")
@@ -886,7 +1181,6 @@ if __name__ == "__main__":
886
 
887
 
888
  demo.launch(
889
- theme=gr.themes.Soft(primary_hue="blue"),
890
  footer_links=[{"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"}],
891
  allowed_paths=["*"]
892
 
 
7
  from datetime import datetime
8
  import re
9
 
10
+
11
+ # ---------------------------------------------------------------------------
12
+ # UI theme + styling. Visual only — does not affect any application logic.
13
+ # ---------------------------------------------------------------------------
14
+ DATATEGRITY_THEME = gr.themes.Soft(
15
+ primary_hue=gr.themes.Color(
16
+ c50="#f8fafc", c100="#f1f5f9", c200="#e2e8f0", c300="#cbd5e1",
17
+ c400="#94a3b8", c500="#64748b", c600="#475569", c700="#334155",
18
+ c800="#1e293b", c900="#0f172a", c950="#020617",
19
+ ),
20
+ secondary_hue="slate",
21
+ neutral_hue="slate",
22
+ radius_size=gr.themes.sizes.radius_md,
23
+ spacing_size=gr.themes.sizes.spacing_md,
24
+ text_size=gr.themes.sizes.text_md,
25
+ font=[gr.themes.GoogleFont("Inter"), "ui-sans-serif", "system-ui", "sans-serif"],
26
+ font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "ui-monospace", "Menlo", "monospace"],
27
+ ).set(
28
+ body_background_fill="#fafafa",
29
+ body_background_fill_dark="#0a0a0a",
30
+ background_fill_primary="#ffffff",
31
+ background_fill_primary_dark="#111113",
32
+ background_fill_secondary="#fafafa",
33
+ background_fill_secondary_dark="#0d0d0f",
34
+ border_color_primary="rgba(15, 23, 42, 0.08)",
35
+ border_color_primary_dark="rgba(241, 245, 249, 0.08)",
36
+ block_border_width="1px",
37
+ block_shadow="none",
38
+ block_radius="14px",
39
+ block_label_background_fill="transparent",
40
+ block_label_background_fill_dark="transparent",
41
+ block_label_text_weight="500",
42
+ block_title_text_weight="600",
43
+ block_title_text_size="*text_md",
44
+ button_large_radius="10px",
45
+ button_small_radius="8px",
46
+ button_primary_background_fill="#0f172a",
47
+ button_primary_background_fill_hover="#1e293b",
48
+ button_primary_background_fill_dark="#f8fafc",
49
+ button_primary_background_fill_hover_dark="#e2e8f0",
50
+ button_primary_text_color="#ffffff",
51
+ button_primary_text_color_dark="#0f172a",
52
+ button_primary_border_color="transparent",
53
+ button_primary_border_color_dark="transparent",
54
+ button_secondary_background_fill="#ffffff",
55
+ button_secondary_background_fill_hover="#f8fafc",
56
+ button_secondary_background_fill_dark="#1a1a1d",
57
+ button_secondary_background_fill_hover_dark="#222227",
58
+ button_secondary_text_color="#0f172a",
59
+ button_secondary_text_color_dark="#f1f5f9",
60
+ button_secondary_border_color="rgba(15, 23, 42, 0.08)",
61
+ button_secondary_border_color_dark="rgba(241, 245, 249, 0.08)",
62
+ input_background_fill="#ffffff",
63
+ input_background_fill_dark="#141417",
64
+ input_border_color="rgba(15, 23, 42, 0.08)",
65
+ input_border_color_dark="rgba(241, 245, 249, 0.08)",
66
+ input_border_color_focus="rgba(15, 23, 42, 0.3)",
67
+ input_border_color_focus_dark="rgba(241, 245, 249, 0.3)",
68
+ input_radius="10px",
69
+ slider_color="#0f172a",
70
+ slider_color_dark="#f1f5f9",
71
+ )
72
+
73
+
74
+ DATATEGRITY_CSS = """
75
+ /* --- Container & typography ------------------------------------------- */
76
+ .gradio-container {
77
+ max-width: 1240px !important;
78
+ animation: dg-page-in 0.55s cubic-bezier(0.16, 1, 0.3, 1);
79
+ }
80
+ .gradio-container * {
81
+ -webkit-font-smoothing: antialiased;
82
+ -moz-osx-font-smoothing: grayscale;
83
+ }
84
+ @keyframes dg-page-in {
85
+ from { opacity: 0; transform: translateY(6px); }
86
+ to { opacity: 1; transform: translateY(0); }
87
+ }
88
+
89
+ /* --- Hero header ------------------------------------------------------ */
90
+ #dg-hero {
91
+ padding: 1.8rem 0 1.4rem 0;
92
+ border: none !important;
93
+ background: transparent !important;
94
+ }
95
+ #dg-hero .dg-eyebrow {
96
+ display: inline-flex;
97
+ align-items: center;
98
+ gap: 0.55rem;
99
+ font-size: 0.72rem;
100
+ font-weight: 500;
101
+ letter-spacing: 0.14em;
102
+ text-transform: uppercase;
103
+ color: var(--body-text-color-subdued);
104
+ margin-bottom: 0.95rem;
105
+ opacity: 0;
106
+ animation: dg-fade-up 0.7s 0.05s cubic-bezier(0.16, 1, 0.3, 1) forwards;
107
+ }
108
+ #dg-hero .dg-title {
109
+ font-size: 2.35rem;
110
+ font-weight: 600;
111
+ line-height: 1.05;
112
+ letter-spacing: -0.028em;
113
+ margin: 0;
114
+ background: linear-gradient(180deg, var(--body-text-color) 0%, color-mix(in srgb, var(--body-text-color) 70%, transparent) 130%);
115
+ -webkit-background-clip: text;
116
+ background-clip: text;
117
+ -webkit-text-fill-color: transparent;
118
+ opacity: 0;
119
+ animation: dg-fade-up 0.8s 0.12s cubic-bezier(0.16, 1, 0.3, 1) forwards;
120
+ }
121
+ #dg-hero .dg-sub {
122
+ color: var(--body-text-color-subdued);
123
+ font-size: 1.02rem;
124
+ line-height: 1.55;
125
+ margin: 0.6rem 0 0 0;
126
+ max-width: 36rem;
127
+ opacity: 0;
128
+ animation: dg-fade-up 0.8s 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
129
+ }
130
+ @keyframes dg-fade-up {
131
+ from { opacity: 0; transform: translateY(8px); }
132
+ to { opacity: 1; transform: translateY(0); }
133
+ }
134
+ .dg-live-dot {
135
+ position: relative;
136
+ width: 6px;
137
+ height: 6px;
138
+ background: #10b981;
139
+ border-radius: 999px;
140
+ }
141
+ .dg-live-dot::after {
142
+ content: "";
143
+ position: absolute;
144
+ inset: -3px;
145
+ border-radius: 999px;
146
+ background: #10b981;
147
+ opacity: 0.4;
148
+ animation: dg-live-pulse 2.4s ease-in-out infinite;
149
+ }
150
+ @keyframes dg-live-pulse {
151
+ 0% { transform: scale(0.6); opacity: 0.45; }
152
+ 70% { transform: scale(2.2); opacity: 0; }
153
+ 100% { transform: scale(2.2); opacity: 0; }
154
+ }
155
+ #dg-divider {
156
+ height: 1px;
157
+ background: linear-gradient(to right, transparent, var(--border-color-primary) 18%, var(--border-color-primary) 82%, transparent);
158
+ margin: 0.25rem 0 1.6rem 0;
159
+ border: none !important;
160
+ padding: 0 !important;
161
+ }
162
+
163
+ /* --- Tabs ------------------------------------------------------------- */
164
+ .tab-nav {
165
+ border-bottom: 1px solid var(--border-color-primary) !important;
166
+ gap: 0.25rem !important;
167
+ margin-bottom: 1.4rem !important;
168
+ background: transparent !important;
169
+ }
170
+ button.tab-nav-button, button[role="tab"] {
171
+ background: transparent !important;
172
+ border: none !important;
173
+ border-radius: 8px 8px 0 0 !important;
174
+ font-weight: 500 !important;
175
+ font-size: 0.92rem !important;
176
+ padding: 0.7rem 1rem !important;
177
+ color: var(--body-text-color-subdued) !important;
178
+ position: relative;
179
+ transition: color 0.2s ease, background 0.2s ease !important;
180
+ }
181
+ button[role="tab"]:hover {
182
+ color: var(--body-text-color) !important;
183
+ background: color-mix(in srgb, var(--body-text-color) 4%, transparent) !important;
184
+ }
185
+ button[role="tab"][aria-selected="true"] {
186
+ color: var(--body-text-color) !important;
187
+ }
188
+ button[role="tab"][aria-selected="true"]::after {
189
+ content: "";
190
+ position: absolute;
191
+ left: 12%;
192
+ right: 12%;
193
+ bottom: -1px;
194
+ height: 2px;
195
+ border-radius: 2px;
196
+ background: var(--body-text-color);
197
+ animation: dg-tab-underline 0.35s cubic-bezier(0.16, 1, 0.3, 1);
198
+ }
199
+ @keyframes dg-tab-underline {
200
+ from { transform: scaleX(0); opacity: 0; }
201
+ to { transform: scaleX(1); opacity: 1; }
202
+ }
203
+
204
+ /* --- Section eyebrow headings (### in Markdown) ----------------------- */
205
+ .gradio-container h3 {
206
+ font-weight: 600 !important;
207
+ font-size: 0.78rem !important;
208
+ text-transform: uppercase !important;
209
+ letter-spacing: 0.08em !important;
210
+ color: var(--body-text-color-subdued) !important;
211
+ margin: 0.4rem 0 0.85rem 0 !important;
212
+ }
213
+ .gradio-container h1, .gradio-container h2 {
214
+ letter-spacing: -0.015em;
215
+ }
216
+
217
+ /* --- Buttons ---------------------------------------------------------- */
218
+ .gr-button, button.lg, button.sm, button.primary, button.secondary {
219
+ transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
220
+ box-shadow 0.22s ease,
221
+ background 0.18s ease,
222
+ border-color 0.18s ease !important;
223
+ font-weight: 500 !important;
224
+ letter-spacing: -0.005em;
225
+ }
226
+ .gr-button:hover, button.primary:hover, button.secondary:hover {
227
+ transform: translateY(-1px);
228
+ box-shadow: 0 6px 18px -10px rgba(15, 23, 42, 0.4) !important;
229
+ }
230
+ .gr-button:active, button.primary:active, button.secondary:active {
231
+ transform: translateY(0);
232
+ transition-duration: 60ms !important;
233
+ }
234
+
235
+ /* --- Blocks / cards --------------------------------------------------- */
236
+ .block, .form, .gr-box {
237
+ transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
238
+ }
239
+ .block:focus-within {
240
+ border-color: color-mix(in srgb, var(--body-text-color) 22%, transparent) !important;
241
+ }
242
+
243
+ /* --- Inputs ----------------------------------------------------------- */
244
+ input[type="text"], input[type="password"], input[type="number"], textarea, select {
245
+ transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease !important;
246
+ }
247
+ input[type="text"]:focus, input[type="password"]:focus,
248
+ input[type="number"]:focus, textarea:focus, select:focus {
249
+ box-shadow: 0 0 0 4px color-mix(in srgb, var(--body-text-color) 6%, transparent) !important;
250
+ }
251
+
252
+ /* mono feel for the rule/operation textareas */
253
+ .dg-mono textarea {
254
+ font-family: var(--font-mono) !important;
255
+ font-size: 0.88rem !important;
256
+ line-height: 1.55 !important;
257
+ }
258
+
259
+ /* --- Dataframe / JSON ------------------------------------------------- */
260
+ .gr-dataframe, .gr-json {
261
+ transition: opacity 0.25s ease;
262
+ }
263
+
264
+ /* --- Accordion -------------------------------------------------------- */
265
+ .label-wrap {
266
+ transition: background 0.2s ease, color 0.2s ease !important;
267
+ border-radius: 8px !important;
268
+ padding: 0.45rem 0.6rem !important;
269
+ }
270
+ .label-wrap:hover {
271
+ background: color-mix(in srgb, var(--body-text-color) 4%, transparent) !important;
272
+ }
273
+
274
+ /* --- File upload dropzone -------------------------------------------- */
275
+ .file-preview, .upload-container, [data-testid="file"] {
276
+ transition: border-color 0.22s ease, background 0.22s ease !important;
277
+ }
278
+ .file-preview:hover, .upload-container:hover {
279
+ border-color: color-mix(in srgb, var(--body-text-color) 22%, transparent) !important;
280
+ }
281
+
282
+ /* --- Footer + misc ---------------------------------------------------- */
283
+ footer {
284
+ opacity: 0.55;
285
+ transition: opacity 0.2s ease;
286
+ }
287
+ footer:hover { opacity: 1; }
288
+
289
+ /* Slight column lift on tab switch */
290
+ .tabitem {
291
+ animation: dg-fade-up 0.45s cubic-bezier(0.16, 1, 0.3, 1);
292
+ }
293
+ """
294
+
295
  def analyze_data_quality(df, columns=None):
296
  """Comprehensive data quality analysis"""
297
  if df is None or df.empty:
 
660
 
661
  def create_demo():
662
  """Create the main Gradio application"""
663
+ with gr.Blocks(theme=DATATEGRITY_THEME, css=DATATEGRITY_CSS, title="Datategrity") as demo:
664
+ gr.HTML(
665
+ """
666
+ <div id="dg-hero">
667
+ <div class="dg-eyebrow"><span class="dg-live-dot"></span>Datategrity · AI-assisted workbench</div>
668
+ <h1 class="dg-title">Data integrity, made effortless.</h1>
669
+ <p class="dg-sub">A minimalist studio for exploring datasets, surfacing anomalies, validating rules, and cleaning data — all in one place.</p>
670
+ </div>
671
+ <div id="dg-divider"></div>
672
+ """
673
+ )
674
 
675
  # Store data globally
676
  data_state = gr.State(value=None)
 
779
  gr.Markdown("💡 **Tip**: Type your rules with real-time suggestions. Format: `column:rule_type:param`")
780
 
781
  rules_input = gr.Textbox(
782
+ label="Rules (format: column:rule_type:param)",
783
  placeholder="id:unique, price:range:0,1000, email:null",
784
  lines=8,
785
+ info="Enter validation rules separated by commas. Use tab for autocomplete suggestions.",
786
+ elem_classes=["dg-mono"],
787
  )
788
 
789
  # Hidden component to store current column list for suggestions
 
803
 
804
  gr.Markdown("### Data Cleaning Operations")
805
  cleaning_ops = gr.Textbox(
806
+ label="Cleaning Operations (format: column:operation)",
807
  placeholder="name:lowercase, price:fill_mean, description:trim",
808
  lines=5,
809
+ info="Enter cleaning operations separated by commas. Format: column:operation",
810
+ elem_classes=["dg-mono"],
811
  )
812
  clean_btn = gr.Button("🧹 Clean Data", variant="secondary")
813
  download_clean_btn = gr.Button("💾 Download Cleaned Data", variant="secondary")
 
1181
 
1182
 
1183
  demo.launch(
 
1184
  footer_links=[{"label": "Built with anycoder", "url": "https://huggingface.co/spaces/akhaliq/anycoder"}],
1185
  allowed_paths=["*"]
1186