File size: 29,796 Bytes
28dbb7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4096a00
 
 
 
28dbb7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI App Builder | Streamlit & Gradio Integration</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #6e8efb, #a777e3);
        }
        .code-block {
            font-family: 'Courier New', monospace;
            background-color: #2d3748;
            color: #f7fafc;
            border-radius: 0.5rem;
            padding: 1rem;
            overflow-x: auto;
        }
        .model-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .preview-window {
            background-color: #f8f9fa;
            border: 1px solid #e2e8f0;
            border-radius: 0.5rem;
            min-height: 300px;
        }
        .tab-active {
            border-bottom: 3px solid #6e8efb;
            color: #6e8efb;
            font-weight: 600;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Navigation -->
    <nav class="gradient-bg text-white shadow-lg">
        <div class="container mx-auto px-6 py-4">
            <div class="flex items-center justify-between">
                <div class="flex items-center space-x-4">
                    <i class="fas fa-robot text-2xl"></i>
                    <span class="text-xl font-bold">AI App Builder</span>
                </div>
                <div class="hidden md:flex items-center space-x-8">
                    <a href="<a href="about.html class="hover:text-gray-200">Features</a>
                    <a href="<a href="about.html class="hover:text-gray-200">Templates</a>
                    <a href="<a href="about.html class="hover:text-gray-200">Documentation</a>
                    <a href="<a href="about.html class="hover:text-gray-200">Pricing</a>
                </div>
                <button class="bg-white text-purple-600 px-4 py-2 rounded-md font-medium hover:bg-gray-100 transition">
                    Get Started
                </button>
            </div>
        </div>
    </nav>

    <!-- Hero Section -->
    <section class="gradient-bg text-white py-20">
        <div class="container mx-auto px-6 text-center">
            <h1 class="text-4xl md:text-6xl font-bold mb-6">Build AI Apps in Minutes</h1>
            <p class="text-xl md:text-2xl mb-8 max-w-3xl mx-auto">
                Create stunning Streamlit and Gradio applications with our no-code builder and multi-model AI integration.
            </p>
            <div class="flex flex-col md:flex-row justify-center gap-4">
                <button class="bg-white text-purple-600 px-8 py-3 rounded-md font-bold hover:bg-gray-100 transition">
                    Start Building <i class="fas fa-arrow-right ml-2"></i>
                </button>
                <button class="bg-transparent border-2 border-white px-8 py-3 rounded-md font-bold hover:bg-white hover:text-purple-600 transition">
                    Watch Demo
                </button>
            </div>
        </div>
    </section>

    <!-- Main App Builder -->
    <section class="py-16">
        <div class="container mx-auto px-6">
            <div class="flex flex-col lg:flex-row gap-8">
                <!-- Left Panel - Controls -->
                <div class="w-full lg:w-1/3 bg-white rounded-xl shadow-md p-6">
                    <h2 class="text-2xl font-bold mb-6 text-gray-800">App Configuration</h2>
                    
                    <!-- Model Selection -->
                    <div class="mb-8">
                        <h3 class="text-lg font-semibold mb-4 text-gray-700">Select AI Model</h3>
                        <div class="grid grid-cols-2 gap-4">
                            <div class="model-card bg-gray-50 p-4 rounded-lg cursor-pointer transition border border-gray-200 hover:border-purple-300">
                                <div class="flex items-center mb-2">
                                    <i class="fas fa-brain text-purple-500 mr-2"></i>
                                    <span class="font-medium">GPT-4</span>
                                </div>
                                <p class="text-sm text-gray-600">Advanced text generation</p>
                            </div>
                            <div class="model-card bg-gray-50 p-4 rounded-lg cursor-pointer transition border border-gray-200 hover:border-purple-300">
                                <div class="flex items-center mb-2">
                                    <i class="fas fa-eye text-blue-500 mr-2"></i>
                                    <span class="font-medium">DALL·E 3</span>
                                </div>
                                <p class="text-sm text-gray-600">Image generation</p>
                            </div>
                            <div class="model-card bg-gray-50 p-4 rounded-lg cursor-pointer transition border border-gray-200 hover:border-purple-300">
                                <div class="flex items-center mb-2">
                                    <i class="fas fa-comments text-green-500 mr-2"></i>
                                    <span class="font-medium">Claude 2</span>
                                </div>
                                <p class="text-sm text-gray-600">Conversational AI</p>
                            </div>
                            <div class="model-card bg-gray-50 p-4 rounded-lg cursor-pointer transition border border-gray-200 hover:border-purple-300">
                                <div class="flex items-center mb-2">
                                    <i class="fas fa-microphone text-red-500 mr-2"></i>
                                    <span class="font-medium">Whisper</span>
                                </div>
                                <p class="text-sm text-gray-600">Speech recognition</p>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Framework Selection -->
                    <div class="mb-8">
                        <h3 class="text-lg font-semibold mb-4 text-gray-700">App Framework</h3>
                        <div class="flex space-x-4">
                            <button id="streamlit-btn" class="framework-btn px-4 py-2 rounded-md bg-purple-100 text-purple-700 font-medium">
                                <i class="fab fa-python mr-2"></i> Streamlit
                            </button>
                            <button id="gradio-btn" class="framework-btn px-4 py-2 rounded-md bg-gray-200 text-gray-700 font-medium">
                                <i class="fas fa-sliders-h mr-2"></i> Gradio
                            </button>
                        </div>
                    </div>
                    
                    <!-- Input Components -->
                    <div class="mb-8">
                        <h3 class="text-lg font-semibold mb-4 text-gray-700">Input Components</h3>
                        <div class="grid grid-cols-3 gap-2">
                            <div class="component-btn p-2 bg-gray-100 rounded text-center cursor-pointer hover:bg-purple-100">
                                <i class="fas fa-font block text-lg mb-1"></i>
                                <span class="text-xs">Text</span>
                            </div>
                            <div class="component-btn p-2 bg-gray-100 rounded text-center cursor-pointer hover:bg-purple-100">
                                <i class="fas fa-image block text-lg mb-1"></i>
                                <span class="text-xs">Image</span>
                            </div>
                            <div class="component-btn p-2 bg-gray-100 rounded text-center cursor-pointer hover:bg-purple-100">
                                <i class="fas fa-file-upload block text-lg mb-1"></i>
                                <span class="text-xs">File</span>
                            </div>
                            <div class="component-btn p-2 bg-gray-100 rounded text-center cursor-pointer hover:bg-purple-100">
                                <i class="fas fa-sliders-h block text-lg mb-1"></i>
                                <span class="text-xs">Slider</span>
                            </div>
                            <div class="component-btn p-2 bg-gray-100 rounded text-center cursor-pointer hover:bg-purple-100">
                                <i class="fas fa-check-square block text-lg mb-1"></i>
                                <span class="text-xs">Checkbox</span>
                            </div>
                            <div class="component-btn p-2 bg-gray-100 rounded text-center cursor-pointer hover:bg-purple-100">
                                <i class="fas fa-microphone block text-lg mb-1"></i>
                                <span class="text-xs">Audio</span>
                            </div>
                        </div>
                    </div>
                    
                    <!-- App Settings -->
                    <div>
                        <h3 class="text-lg font-semibold mb-4 text-gray-700">App Settings</h3>
                        <div class="space-y-4">
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">App Title</label>
                                <input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="My AI App">
                            </div>
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-1">Theme</label>
                                <select class="w-full px-3 py-2 border border-gray-300 rounded-md">
                                    <option>Light</option>
                                    <option>Dark</option>
                                    <option>Custom</option>
                                </select>
                            </div>
                            <div class="flex items-center">
                                <input type="checkbox" id="shareable" class="mr-2">
                                <label for="shareable" class="text-sm text-gray-700">Make shareable</label>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Right Panel - Preview and Code -->
                <div class="w-full lg:w-2/3">
                    <!-- Tabs -->
                    <div class="flex border-b border-gray-200 mb-6">
                        <button id="preview-tab" class="tab-btn px-4 py-2 font-medium text-gray-600 mr-2 tab-active">Live Preview</button>
                        <button id="code-tab" class="tab-btn px-4 py-2 font-medium text-gray-600 mr-2">Generated Code</button>
                        <button id="deploy-tab" class="tab-btn px-4 py-2 font-medium text-gray-600">Deployment</button>
                    </div>
                    
                    <!-- Preview Window -->
                    <div id="preview-content" class="preview-window p-6 mb-6">
                        <h3 class="text-xl font-bold mb-4 text-gray-800">App Preview</h3>
                        <div class="bg-white p-6 rounded-lg shadow-sm">
                            <div class="mb-4">
                                <label class="block text-sm font-medium text-gray-700 mb-1">Enter your prompt</label>
                                <textarea class="w-full px-3 py-2 border border-gray-300 rounded-md" rows="3" placeholder="Type something..."></textarea>
                            </div>
                            <div class="flex justify-between">
                                <div class="flex space-x-2">
                                    <button class="px-3 py-1 bg-gray-100 text-gray-700 rounded text-sm">Clear</button>
                                    <button class="px-3 py-1 bg-gray-100 text-gray-700 rounded text-sm">Examples</button>
                                </div>
                                <button class="px-4 py-1 bg-purple-600 text-white rounded hover:bg-purple-700">Submit</button>
                            </div>
                        </div>
                        <div class="bg-white p-4 mt-4 rounded-lg shadow-sm">
                            <div class="flex items-center mb-2">
                                <div class="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center mr-2">
                                    <i class="fas fa-robot text-purple-600"></i>
                                </div>
                                <span class="font-medium">AI Response</span>
                            </div>
                            <div class="text-gray-700">
                                <p>This is where the AI-generated response will appear. The output will change based on the model you've selected and the input you provide.</p>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Code Window (Hidden by default) -->
                    <div id="code-content" class="hidden code-block mb-6">
                        <div class="flex justify-between items-center mb-4">
                            <h3 class="text-lg font-medium">Generated Python Code</h3>
                            <button class="copy-btn px-3 py-1 bg-gray-700 text-white rounded text-sm hover:bg-gray-600">
                                <i class="fas fa-copy mr-1"></i> Copy
                            </button>
                        </div>
                        <pre id="generated-code">
import streamlit as st
from transformers import pipeline

# Set up the page
st.set_page_config(page_title="My AI App", layout="wide")
st.title("My AI App")

# Initialize the model
@st.cache_resource
def load_model():
    return pipeline("text-generation", model="gpt2")

model = load_model()

# User input
user_input = st.text_area("Enter your prompt", placeholder="Type something...")

# Generate response
if st.button("Submit"):
    if user_input:
        with st.spinner("Generating response..."):
            response = model(user_input, max_length=100, num_return_sequences=1)
            st.write(response[0]['generated_text'])
    else:
        st.warning("Please enter a prompt")
                        </pre>
                    </div>
                    
                    <!-- Deployment Window (Hidden by default) -->
                    <div id="deploy-content" class="hidden bg-white p-6 rounded-lg shadow-sm">
                        <h3 class="text-xl font-bold mb-4 text-gray-800">Deployment Options</h3>
                        <div class="grid md:grid-cols-3 gap-6">
                            <div class="border border-gray-200 rounded-lg p-4 hover:border-purple-300 transition">
                                <div class="flex items-center mb-3">
                                    <i class="fas fa-cloud text-blue-500 text-xl mr-2"></i>
                                    <h4 class="font-medium">Streamlit Cloud</h4>
                                </div>
                                <p class="text-sm text-gray-600 mb-3">Deploy directly to Streamlit's free hosting service.</p>
                                <button class="w-full py-2 bg-blue-100 text-blue-700 rounded text-sm font-medium hover:bg-blue-200">Deploy</button>
                            </div>
                            <div class="border border-gray-200 rounded-lg p-4 hover:border-purple-300 transition">
                                <div class="flex items-center mb-3">
                                    <i class="fab fa-github text-gray-800 text-xl mr-2"></i>
                                    <h4 class="font-medium">GitHub</h4>
                                </div>
                                <p class="text-sm text-gray-600 mb-3">Push to GitHub repository for CI/CD integration.</p>
                                <button class="w-full py-2 bg-gray-100 text-gray-800 rounded text-sm font-medium hover:bg-gray-200">Export</button>
                            </div>
                            <div class="border border-gray-200 rounded-lg p-4 hover:border-purple-300 transition">
                                <div class="flex items-center mb-3">
                                    <i class="fas fa-download text-purple-500 text-xl mr-2"></i>
                                    <h4 class="font-medium">Download</h4>
                                </div>
                                <p class="text-sm text-gray-600 mb-3">Download as Python file to run locally or elsewhere.</p>
                                <button class="w-full py-2 bg-purple-100 text-purple-700 rounded text-sm font-medium hover:bg-purple-200">Download</button>
                            </div>
                        </div>
                        <div class="mt-6 p-4 bg-yellow-50 rounded-lg border border-yellow-200">
                            <div class="flex">
                                <i class="fas fa-info-circle text-yellow-500 mt-1 mr-2"></i>
                                <div>
                                    <h4 class="font-medium text-yellow-800">Deployment Requirements</h4>
                                    <p class="text-sm text-yellow-700 mt-1">Make sure you have Python 3.7+ installed. For GPU acceleration, ensure proper CUDA setup if using local deployment.</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Action Buttons -->
                    <div class="flex justify-end space-x-4 mt-6">
                        <button class="px-6 py-2 border border-gray-300 rounded-md font-medium text-gray-700 hover:bg-gray-50">
                            Save Draft
                        </button>
                        <button class="px-6 py-2 bg-purple-600 text-white rounded-md font-medium hover:bg-purple-700">
                            Export App <i class="fas fa-arrow-right ml-1"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Features Section -->
    <section class="py-16 bg-gray-100">
        <div class="container mx-auto px-6">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">Powerful Features</h2>
            <div class="grid md:grid-cols-3 gap-8">
                <div class="bg-white p-8 rounded-xl shadow-sm hover:shadow-md transition">
                    <div class="w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center mb-4">
                        <i class="fas fa-bolt text-purple-600 text-xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">Multi-Model Integration</h3>
                    <p class="text-gray-600">Seamlessly switch between different AI models including OpenAI, Anthropic, and open-source alternatives.</p>
                </div>
                <div class="bg-white p-8 rounded-xl shadow-sm hover:shadow-md transition">
                    <div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4">
                        <i class="fas fa-code text-blue-600 text-xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">Real-Time Code Generation</h3>
                    <p class="text-gray-600">Get clean, production-ready Python code for both Streamlit and Gradio frameworks.</p>
                </div>
                <div class="bg-white p-8 rounded-xl shadow-sm hover:shadow-md transition">
                    <div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4">
                        <i class="fas fa-share-alt text-green-600 text-xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-3 text-gray-800">One-Click Deployment</h3>
                    <p class="text-gray-600">Deploy your apps directly to Streamlit Cloud, Hugging Face Spaces, or export to GitHub.</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="container mx-auto px-6">
            <div class="grid md:grid-cols-4 gap-8">
                <div>
                    <h3 class="text-lg font-semibold mb-4">AI App Builder</h3>
                    <p class="text-gray-400">Build, customize and deploy AI applications in minutes without writing code.</p>
                </div>
                <div>
                    <h3 class="text-lg font-semibold mb-4">Resources</h3>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Documentation</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Tutorials</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">API Reference</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Community</a></li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-semibold mb-4">Company</h3>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">About</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Blog</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Careers</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Contact</a></li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-semibold mb-4">Subscribe</h3>
                    <p class="text-gray-400 mb-4">Get the latest updates and news.</p>
                    <div class="flex">
                        <input type="email" placeholder="Your email" class="px-4 py-2 bg-gray-800 text-white rounded-l-md focus:outline-none w-full">
                        <button class="bg-purple-600 px-4 py-2 rounded-r-md hover:bg-purple-700">
                            <i class="fas fa-paper-plane"></i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 flex flex-col md:flex-row justify-between items-center">
                <p class="text-gray-400">© 2023 AI App Builder. All rights reserved.</p>
                <div class="flex space-x-6 mt-4 md:mt-0">
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a>
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-github"></i></a>
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin"></i></a>
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-discord"></i></a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        // Tab switching functionality
        const tabs = ['preview', 'code', 'deploy'];
        
        tabs.forEach(tab => {
            const btn = document.getElementById(`${tab}-tab`);
            const content = document.getElementById(`${tab}-content`);
            
            btn.addEventListener('click', () => {
                // Hide all content and remove active class from all tabs
                tabs.forEach(t => {
                    document.getElementById(`${t}-content`).classList.add('hidden');
                    document.getElementById(`${t}-tab`).classList.remove('tab-active');
                });
                
                // Show selected content and add active class to clicked tab
                content.classList.remove('hidden');
                btn.classList.add('tab-active');
            });
        });
        
        // Framework selection
        const frameworks = ['streamlit', 'gradio'];
        
        frameworks.forEach(framework => {
            const btn = document.getElementById(`${framework}-btn`);
            
            btn.addEventListener('click', () => {
                // Remove active class from all framework buttons
                frameworks.forEach(f => {
                    document.getElementById(`${f}-btn`).classList.remove('bg-purple-100', 'text-purple-700');
                    document.getElementById(`${f}-btn`).classList.add('bg-gray-200', 'text-gray-700');
                });
                
                // Add active class to clicked framework
                btn.classList.remove('bg-gray-200', 'text-gray-700');
                btn.classList.add('bg-purple-100', 'text-purple-700');
                
                // Update the generated code based on framework
                updateGeneratedCode(framework);
            });
        });
        
        // Model selection
        document.querySelectorAll('.model-card').forEach(card => {
            card.addEventListener('click', () => {
                // Remove selection from all cards
                document.querySelectorAll('.model-card').forEach(c => {
                    c.classList.remove('border-purple-300', 'bg-purple-50');
                });
                
                // Add selection to clicked card
                card.classList.add('border-purple-300', 'bg-purple-50');
                
                // Update preview and code based on selected model
                updateModelSelection(card.querySelector('span').textContent);
            });
        });
        
        // Component selection
        document.querySelectorAll('.component-btn').forEach(btn => {
            btn.addEventListener('click', () => {
                // Add component to preview and update code
                addComponent(btn.querySelector('span').textContent);
            });
        });
        
        // Copy code button
        document.querySelector('.copy-btn').addEventListener('click', () => {
            const code = document.getElementById('generated-code').textContent;
            navigator.clipboard.writeText(code);
            
            // Show copied feedback
            const btn = document.querySelector('.copy-btn');
            const originalText = btn.innerHTML;
            btn.innerHTML = '<i class="fas fa-check mr-1"></i> Copied!';
            
            setTimeout(() => {
                btn.innerHTML = originalText;
            }, 2000);
        });
        
        // Helper functions
        function updateGeneratedCode(framework) {
            const codeElement = document.getElementById('generated-code');
            if (framework === 'streamlit') {
                codeElement.textContent = `import streamlit as st
from transformers import pipeline

# Set up the page
st.set_page_config(page_title="My AI App", layout="wide")
st.title("My AI App")

# Initialize the model
@st.cache_resource
def load_model():
    return pipeline("text-generation", model="gpt2")

model = load_model()

# User input
user_input = st.text_area("Enter your prompt", placeholder="Type something...")

# Generate response
if st.button("Submit"):
    if user_input:
        with st.spinner("Generating response..."):
            response = model(user_input, max_length=100, num_return_sequences=1)
            st.write(response[0]['generated_text'])
    else:
        st.warning("Please enter a prompt")`;
            } else {
                codeElement.textContent = `import gradio as gr
from transformers import pipeline

# Initialize the model
model = pipeline("text-generation", model="gpt2")

def generate_text(prompt):
    if not prompt:
        return "Please enter a prompt"
    output = model(prompt, max_length=100, num_return_sequences=1)
    return output[0]['generated_text']

# Create Gradio interface
demo = gr.Interface(
    fn=generate_text,
    inputs=gr.Textbox(placeholder="Type something...", label="Input"),
    outputs=gr.Textbox(label="Generated Text"),
    title="My AI App"
)

demo.launch()`;
            }
        }
        
        function updateModelSelection(modelName) {
            // In a real app, this would update the preview and code based on selected model
            console.log(`Model changed to: ${modelName}`);
        }
        
        function addComponent(componentType) {
            // In a real app, this would add the component to the preview and update code
            console.log(`Adding component: ${componentType}`);
        }
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=S-Dreamer/ai-appbuilder" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>