PD03 commited on
Commit
ef36ca7
Β·
verified Β·
1 Parent(s): bc95660

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +408 -3
app.py CHANGED
@@ -1,6 +1,411 @@
1
  import gradio as gr
2
 
3
- def hello(name):
4
- return f"Hello, {name}!"
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=hello, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def submit_action(*inputs):
4
+ return (
5
+ f"<div style='padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 16px; margin-top: 20px;'>"
6
+ f"<div style='color: white; font-size: 1.3em; font-weight: 600; margin-bottom: 8px;'>πŸŽ‰ Registration Submitted Successfully!</div>"
7
+ f"<div style='color: rgba(255,255,255,0.9); font-size: 1.1em; margin-bottom: 16px;'>Welcome aboard, <span style='font-weight: 600;'>{inputs[0]}</span>!</div>"
8
+ f"<div style='display: flex; gap: 12px; flex-wrap: wrap;'>"
9
+ f"<span style='background: rgba(34, 197, 94, 0.2); color: #22c55e; padding: 8px 16px; border-radius: 24px; font-size: 0.9em; font-weight: 500; border: 1px solid rgba(34, 197, 94, 0.3);'>βœ“ Verified</span>"
10
+ f"<span style='background: rgba(245, 158, 11, 0.2); color: #f59e0b; padding: 8px 16px; border-radius: 24px; font-size: 0.9em; font-weight: 500; border: 1px solid rgba(245, 158, 11, 0.3);'>⏳ Approval Pending</span>"
11
+ f"</div>"
12
+ f"</div>"
13
+ )
14
 
15
+ with gr.Blocks(css="""
16
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
17
+
18
+ * {
19
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
20
+ }
21
+
22
+ .gradio-container {
23
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
24
+ min-height: 100vh;
25
+ padding: 2rem 1rem;
26
+ }
27
+
28
+ .main-card {
29
+ max-width: 1100px;
30
+ margin: 0 auto;
31
+ background: rgba(255, 255, 255, 0.95);
32
+ backdrop-filter: blur(20px);
33
+ border-radius: 24px;
34
+ box-shadow: 0 32px 64px rgba(0, 0, 0, 0.1);
35
+ padding: 0;
36
+ border: 1px solid rgba(255, 255, 255, 0.2);
37
+ overflow: hidden;
38
+ }
39
+
40
+ .header-section {
41
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
42
+ padding: 40px 48px;
43
+ color: white;
44
+ position: relative;
45
+ overflow: hidden;
46
+ }
47
+
48
+ .header-section::before {
49
+ content: '';
50
+ position: absolute;
51
+ top: -50%;
52
+ right: -50%;
53
+ width: 200%;
54
+ height: 200%;
55
+ background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
56
+ animation: float 6s ease-in-out infinite;
57
+ }
58
+
59
+ @keyframes float {
60
+ 0%, 100% { transform: translateY(0px) rotate(0deg); }
61
+ 50% { transform: translateY(-20px) rotate(180deg); }
62
+ }
63
+
64
+ .step-indicator {
65
+ display: flex;
66
+ align-items: center;
67
+ gap: 16px;
68
+ margin-bottom: 32px;
69
+ position: relative;
70
+ z-index: 1;
71
+ }
72
+
73
+ .step {
74
+ display: flex;
75
+ align-items: center;
76
+ gap: 8px;
77
+ padding: 8px 16px;
78
+ border-radius: 20px;
79
+ font-size: 0.9em;
80
+ font-weight: 500;
81
+ transition: all 0.3s ease;
82
+ }
83
+
84
+ .step.active {
85
+ background: rgba(255, 255, 255, 0.2);
86
+ color: white;
87
+ font-weight: 600;
88
+ }
89
+
90
+ .step.inactive {
91
+ color: rgba(255, 255, 255, 0.6);
92
+ }
93
+
94
+ .step-arrow {
95
+ color: rgba(255, 255, 255, 0.4);
96
+ font-size: 1.2em;
97
+ }
98
+
99
+ .main-title {
100
+ font-size: 2.5em;
101
+ font-weight: 800;
102
+ margin-bottom: 8px;
103
+ position: relative;
104
+ z-index: 1;
105
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
106
+ }
107
+
108
+ .subtitle {
109
+ font-size: 1.2em;
110
+ color: rgba(255, 255, 255, 0.9);
111
+ font-weight: 400;
112
+ position: relative;
113
+ z-index: 1;
114
+ }
115
+
116
+ .form-content {
117
+ padding: 48px;
118
+ }
119
+
120
+ .section-title {
121
+ font-size: 1.3em;
122
+ font-weight: 700;
123
+ color: #1f2937;
124
+ margin-bottom: 24px;
125
+ margin-top: 40px;
126
+ position: relative;
127
+ padding-left: 16px;
128
+ }
129
+
130
+ .section-title::before {
131
+ content: '';
132
+ position: absolute;
133
+ left: 0;
134
+ top: 50%;
135
+ transform: translateY(-50%);
136
+ width: 4px;
137
+ height: 24px;
138
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
139
+ border-radius: 2px;
140
+ }
141
+
142
+ .section-title:first-of-type {
143
+ margin-top: 0;
144
+ }
145
+
146
+ .input-group {
147
+ display: grid;
148
+ grid-template-columns: 1fr 1fr;
149
+ gap: 32px;
150
+ margin-bottom: 32px;
151
+ }
152
+
153
+ .input-wrapper {
154
+ position: relative;
155
+ }
156
+
157
+ .verification-badge {
158
+ display: inline-flex;
159
+ align-items: center;
160
+ gap: 6px;
161
+ padding: 6px 12px;
162
+ border-radius: 20px;
163
+ font-size: 0.85em;
164
+ font-weight: 500;
165
+ margin-left: 8px;
166
+ transition: all 0.3s ease;
167
+ }
168
+
169
+ .badge-verified {
170
+ background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
171
+ color: #065f46;
172
+ border: 1px solid #a7f3d0;
173
+ }
174
+
175
+ .badge-pending {
176
+ background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
177
+ color: #92400e;
178
+ border: 1px solid #fde68a;
179
+ }
180
+
181
+ .status-section {
182
+ background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
183
+ padding: 24px;
184
+ border-radius: 16px;
185
+ margin: 24px 0;
186
+ border: 1px solid #e2e8f0;
187
+ }
188
+
189
+ .status-badges {
190
+ display: flex;
191
+ gap: 12px;
192
+ flex-wrap: wrap;
193
+ margin-bottom: 16px;
194
+ }
195
+
196
+ .access-level {
197
+ color: #64748b;
198
+ font-size: 0.95em;
199
+ font-weight: 500;
200
+ }
201
+
202
+ .summary-table {
203
+ width: 100%;
204
+ border-collapse: collapse;
205
+ margin-top: 16px;
206
+ }
207
+
208
+ .summary-table td {
209
+ padding: 12px 0;
210
+ border-bottom: 1px solid #e2e8f0;
211
+ font-size: 0.95em;
212
+ }
213
+
214
+ .summary-table td:first-child {
215
+ color: #64748b;
216
+ font-weight: 500;
217
+ width: 180px;
218
+ }
219
+
220
+ .summary-table td:last-child {
221
+ color: #1f2937;
222
+ font-weight: 600;
223
+ }
224
+
225
+ .submit-btn {
226
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
227
+ color: white;
228
+ border: none;
229
+ padding: 16px 32px;
230
+ border-radius: 12px;
231
+ font-size: 1.1em;
232
+ font-weight: 600;
233
+ cursor: pointer;
234
+ transition: all 0.3s ease;
235
+ box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
236
+ margin-top: 32px;
237
+ width: 100%;
238
+ }
239
+
240
+ .submit-btn:hover {
241
+ transform: translateY(-2px);
242
+ box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
243
+ }
244
+
245
+ /* Gradio component styling */
246
+ .gradio-textbox, .gradio-dropdown {
247
+ border-radius: 12px !important;
248
+ border: 2px solid #e2e8f0 !important;
249
+ transition: all 0.3s ease !important;
250
+ }
251
+
252
+ .gradio-textbox:focus, .gradio-dropdown:focus {
253
+ border-color: #667eea !important;
254
+ box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
255
+ }
256
+
257
+ .gradio-textbox input, .gradio-dropdown select {
258
+ font-size: 0.95em !important;
259
+ padding: 12px 16px !important;
260
+ }
261
+
262
+ label {
263
+ font-weight: 600 !important;
264
+ color: #374151 !important;
265
+ margin-bottom: 8px !important;
266
+ font-size: 0.9em !important;
267
+ }
268
+
269
+ @media (max-width: 768px) {
270
+ .main-card {
271
+ margin: 0 16px;
272
+ border-radius: 16px;
273
+ }
274
+
275
+ .header-section {
276
+ padding: 32px 24px;
277
+ }
278
+
279
+ .form-content {
280
+ padding: 32px 24px;
281
+ }
282
+
283
+ .input-group {
284
+ grid-template-columns: 1fr;
285
+ gap: 24px;
286
+ }
287
+
288
+ .main-title {
289
+ font-size: 2em;
290
+ }
291
+
292
+ .step-indicator {
293
+ flex-wrap: wrap;
294
+ gap: 8px;
295
+ }
296
+ }
297
+ """) as demo:
298
+ with gr.Group(elem_classes="main-card"):
299
+ # Header Section
300
+ gr.HTML("""
301
+ <div class='header-section'>
302
+ <div class='step-indicator'>
303
+ <div class='step active'>
304
+ <span>1</span>
305
+ <span>Onboarding</span>
306
+ </div>
307
+ <div class='step-arrow'>β†’</div>
308
+ <div class='step inactive'>
309
+ <span>2</span>
310
+ <span>Documents</span>
311
+ </div>
312
+ <div class='step-arrow'>β†’</div>
313
+ <div class='step inactive'>
314
+ <span>3</span>
315
+ <span>Complete</span>
316
+ </div>
317
+ </div>
318
+ <div class='main-title'>Business Partner Registration</div>
319
+ <div class='subtitle'>Auto Digital Public Infrastructure Platform</div>
320
+ </div>
321
+ """)
322
+
323
+ # Form Content
324
+ with gr.Group(elem_classes="form-content"):
325
+ # Identification Section
326
+ gr.HTML("<div class='section-title'>🏒 Company Identification</div>")
327
+ with gr.Row(elem_classes="input-group"):
328
+ legal_name = gr.Textbox(label="Legal Entity Name", value="ABC Enterprises")
329
+ legal_type = gr.Dropdown(choices=["OEM", "Supplier", "Distributor"], label="Legal Entity Type", value="OEM")
330
+
331
+ # Location Section
332
+ gr.HTML("<div class='section-title'>πŸ“ Business Location</div>")
333
+ with gr.Row(elem_classes="input-group"):
334
+ with gr.Column():
335
+ country = gr.Dropdown(choices=["India"], value="India", label="Country")
336
+ state = gr.Dropdown(choices=["Haryana", "Karnataka"], value="Haryana", label="State")
337
+ city = gr.Dropdown(choices=["Faridabad", "Bangalore"], value="Faridabad", label="City")
338
+ with gr.Column():
339
+ plant_address = gr.Textbox(label="Plant Address", placeholder="Enter your complete plant address...", lines=2)
340
+ postal_code = gr.Textbox(label="Postal Code", value="121002")
341
+
342
+ # Legal Identifiers Section
343
+ gr.HTML("<div class='section-title'>πŸ“‹ Legal Identifiers</div>")
344
+ with gr.Row(elem_classes="input-group"):
345
+ with gr.Column():
346
+ with gr.Row():
347
+ gstin = gr.Textbox(label="GSTIN", value="22AAAAA0000A1Z5")
348
+ gr.HTML("<span class='verification-badge badge-verified'>βœ“ Verified</span>")
349
+ with gr.Row():
350
+ pan = gr.Textbox(label="PAN", value="AAAAA0000A")
351
+ gr.HTML("<span class='verification-badge badge-verified'>βœ“ Verified</span>")
352
+ with gr.Row():
353
+ cin = gr.Textbox(label="CIN", value="L01631KA2010PTC096843")
354
+ gr.HTML("<span class='verification-badge badge-verified'>βœ“ Verified</span>")
355
+ with gr.Column():
356
+ global_id_type = gr.Dropdown(choices=["DUNS", "LEI"], value="DUNS", label="Global ID Type")
357
+ global_id = gr.Textbox(label="Global ID Number", value="XXYYZZ1234567890")
358
+
359
+ # Status Section
360
+ gr.HTML("""
361
+ <div class='status-section'>
362
+ <div class='status-badges'>
363
+ <span class='verification-badge badge-verified'>βœ… Auto-Verified (Government Database)</span>
364
+ <span class='verification-badge badge-pending'>⏳ Approval Pending</span>
365
+ </div>
366
+ <div class='access-level'>
367
+ <strong>Access Level:</strong> Public & Private Infrastructure
368
+ </div>
369
+ </div>
370
+ """)
371
+
372
+ # Registration Summary
373
+ gr.HTML("<div class='section-title'>πŸ“Š Registration Summary</div>")
374
+ gr.HTML("""
375
+ <table class='summary-table'>
376
+ <tr>
377
+ <td>Registration Date</td>
378
+ <td>29/05/2025 11:02:02 AM</td>
379
+ </tr>
380
+ <tr>
381
+ <td>Last Updated</td>
382
+ <td>29/05/2025 12:07:23 PM</td>
383
+ </tr>
384
+ <tr>
385
+ <td>Updated By</td>
386
+ <td>SYSTEM-ADMIN</td>
387
+ </tr>
388
+ <tr>
389
+ <td>Approval Date</td>
390
+ <td>29/05/2025 12:07:23 PM</td>
391
+ </tr>
392
+ <tr>
393
+ <td>Approved By</td>
394
+ <td>ADMIN-APPROVER</td>
395
+ </tr>
396
+ </table>
397
+ """)
398
+
399
+ # Output for success message
400
+ output = gr.HTML()
401
+
402
+ # Submit Button
403
+ submit_btn = gr.Button("πŸš€ Submit Registration", elem_classes="submit-btn")
404
+ submit_btn.click(
405
+ submit_action,
406
+ [legal_name, legal_type, country, state, city, plant_address, postal_code,
407
+ gstin, pan, cin, global_id_type, global_id],
408
+ output
409
+ )
410
+
411
+ demo.launch()