Yordann commited on
Commit
3225e49
·
verified ·
1 Parent(s): 17a86bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +324 -76
app.py CHANGED
@@ -70,82 +70,330 @@ def reset_textbox():
70
 
71
  # ==== Custom CSS ====
72
  custom_css = """
73
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
74
- * {
75
- font-family: 'Inter', sans-serif !important;
76
- }
77
- .gradio-container {
78
- background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%) !important;
79
- min-height: 100vh !important;
80
- }
81
- .main-header {
82
- background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%) !important;
83
- padding: 2rem 0 !important;
84
- text-align: center !important;
85
- border-bottom: 2px solid #ff4d00 !important;
86
- margin-bottom: 2rem !important;
87
- }
88
- .main-header h1 {
89
- color: #ffffff !important;
90
- font-size: 3rem !important;
91
- font-weight: 800 !important;
92
- text-shadow: 0 0 20px rgba(255, 77, 0, 0.3) !important;
93
- }
94
- .main-header p {
95
- color: #cccccc !important;
96
- font-size: 1.2rem !important;
97
- }
98
- .chatbot-container {
99
- background: rgba(42, 42, 42, 0.8) !important;
100
- border: 2px solid #ff4d00 !important;
101
- border-radius: 20px !important;
102
- box-shadow: 0 10px 30px rgba(255, 77, 0, 0.2) !important;
103
- margin-bottom: 2rem !important;
104
- }
105
- .input-container textarea {
106
- background: #2a2a2a !important;
107
- border: 1px solid #ff4d00 !important;
108
- border-radius: 10px !important;
109
- color: #ffffff !important;
110
- font-size: 1.1rem !important;
111
- padding: 1rem !important;
112
- resize: none !important;
113
- }
114
- .input-container textarea:focus {
115
- border-color: #ff6d20 !important;
116
- box-shadow: 0 0 15px rgba(255, 77, 0, 0.3) !important;
117
- outline: none !important;
118
- }
119
- .submit-button {
120
- background: linear-gradient(135deg, #ff4d00 0%, #ff6d20 100%) !important;
121
- border: none !important;
122
- border-radius: 12px !important;
123
- color: #ffffff !important;
124
- font-size: 1.2rem !important;
125
- font-weight: 600 !important;
126
- padding: 1rem 2rem !important;
127
- transition: all 0.3s ease !important;
128
- box-shadow: 0 5px 15px rgba(255, 77, 0, 0.3) !important;
129
- }
130
- .submit-button:hover {
131
- background: linear-gradient(135deg, #ff6d20 0%, #ff8d40 100%) !important;
132
- transform: translateY(-2px) !important;
133
- box-shadow: 0 8px 25px rgba(255, 77, 0, 0.4) !important;
134
- }
135
- .slider-container label {
136
- color: #ffffff !important;
137
- font-weight: 600 !important;
138
- font-size: 1rem !important;
139
- }
140
- .status-container textarea {
141
- background: transparent !important;
142
- border: none !important;
143
- color: #4CAF50 !important;
144
- font-weight: 600 !important;
145
- }
146
- .footer {
147
- display: none !important;
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  """
150
 
151
  # ==== Theme ====
 
70
 
71
  # ==== Custom CSS ====
72
  custom_css = """
73
+ <!DOCTYPE html>
74
+ <html lang="en">
75
+ <head>
76
+ <meta charset="UTF-8">
77
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
78
+ <title>MasterBrand AI Assistant - Enhanced UI Demo</title>
79
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
80
+ <style>
81
+ * {
82
+ margin: 0;
83
+ padding: 0;
84
+ box-sizing: border-box;
85
+ font-family: 'Inter', sans-serif;
86
+ }
87
+
88
+ body {
89
+ background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #2a1a1a 100%);
90
+ min-height: 100vh;
91
+ color: #ffffff;
92
+ }
93
+
94
+ .main-header {
95
+ background: linear-gradient(135deg, #0a0a0a 0%, #1a0a0a 50%, #2a1a1a 100%);
96
+ padding: 3rem 0;
97
+ text-align: center;
98
+ border-bottom: 3px solid #00ff41;
99
+ margin-bottom: 2rem;
100
+ position: relative;
101
+ overflow: hidden;
102
+ }
103
+
104
+ .main-header::before {
105
+ content: '';
106
+ position: absolute;
107
+ top: 0;
108
+ left: 0;
109
+ right: 0;
110
+ bottom: 0;
111
+ background: radial-gradient(circle at 50% 50%, rgba(0, 255, 65, 0.1) 0%, transparent 70%);
112
+ pointer-events: none;
113
+ }
114
+
115
+ .logo-container {
116
+ display: flex;
117
+ align-items: center;
118
+ justify-content: center;
119
+ gap: 1rem;
120
+ margin-bottom: 1rem;
121
+ }
122
+
123
+ .logo-image {
124
+ width: 60px;
125
+ height: 60px;
126
+ border-radius: 12px;
127
+ box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
128
+ background: #00ff41;
129
+ padding: 8px;
130
+ animation: pulse 3s infinite;
131
+ }
132
+
133
+ @keyframes pulse {
134
+ 0% { box-shadow: 0 0 20px rgba(0, 255, 65, 0.3); }
135
+ 50% { box-shadow: 0 0 30px rgba(0, 255, 65, 0.6); }
136
+ 100% { box-shadow: 0 0 20px rgba(0, 255, 65, 0.3); }
137
+ }
138
+
139
+ .main-header h1 {
140
+ font-size: 3.5rem;
141
+ font-weight: 900;
142
+ text-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
143
+ background: linear-gradient(135deg, #ffffff 0%, #00ff41 100%);
144
+ -webkit-background-clip: text;
145
+ -webkit-text-fill-color: transparent;
146
+ background-clip: text;
147
+ margin: 0;
148
+ }
149
+
150
+ .main-header p {
151
+ color: #cccccc;
152
+ font-size: 1.3rem;
153
+ font-weight: 500;
154
+ margin-top: 0.5rem;
155
+ }
156
+
157
+ .subtitle {
158
+ font-size: 1rem;
159
+ color: #00ff41;
160
+ font-weight: 600;
161
+ margin-top: 1rem;
162
+ }
163
+
164
+ .container {
165
+ max-width: 1200px;
166
+ margin: 0 auto;
167
+ padding: 0 2rem;
168
+ }
169
+
170
+ .chatbot-container {
171
+ background: rgba(26, 26, 26, 0.95);
172
+ border: 2px solid #00ff41;
173
+ border-radius: 25px;
174
+ box-shadow: 0 15px 40px rgba(0, 255, 65, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
175
+ margin-bottom: 2rem;
176
+ backdrop-filter: blur(10px);
177
+ padding: 2rem;
178
+ min-height: 400px;
179
+ }
180
+
181
+ .chat-messages {
182
+ height: 350px;
183
+ overflow-y: auto;
184
+ margin-bottom: 1rem;
185
+ padding: 1rem;
186
+ background: rgba(42, 42, 42, 0.5);
187
+ border-radius: 15px;
188
+ }
189
+
190
+ .message {
191
+ background: rgba(42, 42, 42, 0.8);
192
+ border-radius: 15px;
193
+ margin: 0.5rem 0;
194
+ padding: 1rem;
195
+ border-left: 4px solid #00ff41;
196
+ }
197
+
198
+ .message.user {
199
+ background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
200
+ border-left: 4px solid #00ff41;
201
+ margin-left: 2rem;
202
+ }
203
+
204
+ .message.bot {
205
+ background: linear-gradient(135deg, #1a2a1a 0%, #2a3a2a 100%);
206
+ border-left: 4px solid #00cc33;
207
+ margin-right: 2rem;
208
+ }
209
+
210
+ .input-container {
211
+ position: relative;
212
+ margin-bottom: 1rem;
213
+ }
214
+
215
+ .input-container textarea {
216
+ background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
217
+ border: 2px solid #00ff41;
218
+ border-radius: 15px;
219
+ color: #ffffff;
220
+ font-size: 1.1rem;
221
+ padding: 1.2rem;
222
+ resize: none;
223
+ transition: all 0.3s ease;
224
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
225
+ width: 100%;
226
+ min-height: 80px;
227
+ }
228
+
229
+ .input-container textarea:focus {
230
+ border-color: #00ff41;
231
+ box-shadow: 0 0 25px rgba(0, 255, 65, 0.4), 0 5px 15px rgba(0, 0, 0, 0.3);
232
+ outline: none;
233
+ transform: translateY(-2px);
234
+ }
235
+
236
+ .input-container textarea::placeholder {
237
+ color: #888888;
238
+ font-style: italic;
239
+ }
240
+
241
+ .submit-button {
242
+ background: linear-gradient(135deg, #00ff41 0%, #00cc33 100%);
243
+ border: none;
244
+ border-radius: 15px;
245
+ color: #000000;
246
+ font-size: 1.2rem;
247
+ font-weight: 700;
248
+ padding: 1.2rem 2.5rem;
249
+ transition: all 0.3s ease;
250
+ box-shadow: 0 8px 20px rgba(0, 255, 65, 0.3);
251
+ text-transform: uppercase;
252
+ letter-spacing: 1px;
253
+ cursor: pointer;
254
+ width: 100%;
255
+ }
256
+
257
+ .submit-button:hover {
258
+ background: linear-gradient(135deg, #00cc33 0%, #00aa2a 100%);
259
+ transform: translateY(-3px);
260
+ box-shadow: 0 12px 30px rgba(0, 255, 65, 0.4);
261
+ }
262
+
263
+ .submit-button:active {
264
+ transform: translateY(-1px);
265
+ }
266
+
267
+ .footer {
268
+ text-align: center;
269
+ padding: 2rem;
270
+ color: #666666;
271
+ border-top: 1px solid #333333;
272
+ margin-top: 3rem;
273
+ }
274
+
275
+ .footer p {
276
+ margin: 0;
277
+ font-size: 0.9rem;
278
+ }
279
+
280
+ .footer .sub-text {
281
+ margin: 0.5rem 0 0 0;
282
+ font-size: 0.8rem;
283
+ color: #888888;
284
+ }
285
+
286
+ @media (max-width: 768px) {
287
+ .main-header h1 {
288
+ font-size: 2.5rem;
289
+ }
290
+
291
+ .main-header p {
292
+ font-size: 1.1rem;
293
+ }
294
+
295
+ .logo-image {
296
+ width: 50px;
297
+ height: 50px;
298
+ }
299
+
300
+ .container {
301
+ padding: 0 1rem;
302
+ }
303
+ }
304
+ </style>
305
+ </head>
306
+ <body>
307
+ <div class="main-header">
308
+ <div class="logo-container">
309
+ <div class="logo-image">🚀</div>
310
+ <h1>MASTERBRAND AI ASSISTANT</h1>
311
+ </div>
312
+ <p>Your Personal E-commerce Business Expert - Available in English & Bulgarian</p>
313
+ <p class="subtitle">
314
+ 🚀 Powered by Advanced AI • 🌍 Multilingual Support • 💼 Expert Business Guidance
315
+ </p>
316
+ </div>
317
+
318
+ <div class="container">
319
+ <div class="chatbot-container">
320
+ <h3 style="margin-bottom: 1rem; color: #00ff41;">💬 Chat with MasterBrand AI</h3>
321
+
322
+ <div class="chat-messages" id="chatMessages">
323
+ <div class="message bot">
324
+ <strong>MasterBrand AI:</strong> Welcome! I'm here to help you build and grow your e-commerce business. Whether you're just starting out or looking to scale, I can provide expert guidance on everything from product selection to marketing strategies. What would you like to know?
325
+ </div>
326
+ </div>
327
+
328
+ <div class="input-container">
329
+ <textarea id="userInput" placeholder="Ask me anything about your e-commerce business... 💡" rows="3"></textarea>
330
+ </div>
331
+
332
+ <button class="submit-button" onclick="sendMessage()">
333
+ 🚀 Get Expert Advice
334
+ </button>
335
+ </div>
336
+ </div>
337
+
338
+ <div class="footer">
339
+ <p>© 2025 MasterBrand AI Assistant • Built with ❤️ for E-commerce Success</p>
340
+ <p class="sub-text">Empowering entrepreneurs worldwide with AI-driven business insights</p>
341
+ </div>
342
+
343
+ <script>
344
+ function sendMessage() {
345
+ const input = document.getElementById('userInput');
346
+ const messages = document.getElementById('chatMessages');
347
+ const userMessage = input.value.trim();
348
+
349
+ if (!userMessage) return;
350
+
351
+ // Add user message
352
+ const userDiv = document.createElement('div');
353
+ userDiv.className = 'message user';
354
+ userDiv.innerHTML = `<strong>You:</strong> ${userMessage}`;
355
+ messages.appendChild(userDiv);
356
+
357
+ // Clear input
358
+ input.value = '';
359
+
360
+ // Simulate AI response
361
+ setTimeout(() => {
362
+ const botDiv = document.createElement('div');
363
+ botDiv.className = 'message bot';
364
+
365
+ let response = '';
366
+ if (userMessage.toLowerCase().includes('start') || userMessage.toLowerCase().includes('begin')) {
367
+ response = "Great question! Starting an e-commerce business is exciting. First, let's identify your niche - what products are you passionate about? Then we'll work on market research, setting up your online store, and creating a marketing strategy. What specific area interests you most?";
368
+ } else if (userMessage.toLowerCase().includes('marketing')) {
369
+ response = "Marketing is crucial for e-commerce success! Focus on: 1) Social media presence (Instagram, Facebook, TikTok), 2) Content marketing (blogs, videos), 3) Email campaigns, 4) SEO optimization, and 5) Influencer partnerships. Which channel would you like to explore first?";
370
+ } else if (userMessage.toLowerCase().includes('product')) {
371
+ response = "Product selection is key! Consider: 1) Market demand and trends, 2) Profit margins, 3) Competition analysis, 4) Your expertise and passion, 5) Shipping and storage requirements. Research tools like Google Trends and Amazon Best Sellers can help. What product category are you considering?";
372
+ } else {
373
+ response = "I'm here to help with your e-commerce journey! Whether you need advice on starting your business, marketing strategies, product selection, or scaling operations, I can provide expert guidance based on proven Masterbrand principles. What specific challenge can I help you with today?";
374
+ }
375
+
376
+ botDiv.innerHTML = `<strong>MasterBrand AI:</strong> ${response}`;
377
+ messages.appendChild(botDiv);
378
+
379
+ // Scroll to bottom
380
+ messages.scrollTop = messages.scrollHeight;
381
+ }, 1000);
382
+
383
+ // Scroll to bottom
384
+ messages.scrollTop = messages.scrollHeight;
385
+ }
386
+
387
+ // Allow Enter key to send message
388
+ document.getElementById('userInput').addEventListener('keypress', function(e) {
389
+ if (e.key === 'Enter' && !e.shiftKey) {
390
+ e.preventDefault();
391
+ sendMessage();
392
+ }
393
+ });
394
+ </script>
395
+ </body>
396
+ </html>
397
  """
398
 
399
  # ==== Theme ====