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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +259 -353
app.py CHANGED
@@ -3,6 +3,7 @@ from transformers import pipeline
3
  from langdetect import detect
4
  from huggingface_hub import login
5
  import os
 
6
 
7
  login(token=os.getenv("chatbot"))
8
  generator = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.1")
@@ -30,7 +31,7 @@ Your expertise is rooted in the principles taught by Masterbrand, which focuses
30
  2. Business Development and Growth: Providing insights into developing online businesses, implementing effective growth strategies, and structuring a business for long-term success.
31
  3. Strategic Implementation: Offering practical advice on applying working strategies and business structures that lead to real sales and tangible results.
32
  4. Brand Building: Assisting users in transforming their initial ideas into established, profitable brands.
33
- 5. Market Context (Bulgaria): While your advice is universally applicable, you understand the nuances of the e-commerce landscape, particularly in regions like Bulgaria, given Masterbrand's origin as the #1 ECOM training in Bulgaria.
34
  6. Learning Resource Guidance: You can refer to the types of resources found in Masterbrand (e.g., video lessons, modules, practical resources) to explain concepts or suggest learning paths.
35
  Tone and Communication Style:
36
  Your communication should always be:
@@ -44,9 +45,9 @@ You should not provide financial or legal advice. Always recommend consulting wi
44
  Your knowledge is based on the principles of successful e-commerce as observed and taught by Masterbrand. While comprehensive, it is not exhaustive of all possible e-commerce strategies.
45
  Example Interaction Flow:
46
  User: "I want to start an online store, but I have no idea where to begin."
47
- Bot: "That's a fantastic goal! Many successful e-commerce brands started exactly where you are now. To begin, let's think about what you're passionate about or what problem you want to solve for customers. This will help us choose a niche. Once we have a niche, we can explore simple ways to set up your first online presence. What kind of products or services are you considering?"
48
  Integration with User Input:
49
- Always consider the user's specific input and tailor your advice accordingly. If the user provides a specific question or scenario, address it directly while integrating the core principles of e-commerce success.
50
  User said:
51
  {user_input_translated}
52
  Give simple, friendly, clear advice:
@@ -63,372 +64,247 @@ Give simple, friendly, clear advice:
63
  history.append({"role": "assistant", "content": response_text})
64
 
65
  chat_counter += 1
66
- return history, history, chat_counter, "✅ Success", gr.update(value=''), gr.update(interactive=True)
67
 
68
  def reset_textbox():
69
- return gr.update(value='', interactive=False), gr.update(interactive=False)
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 ====
400
- masterbrand_theme = gr.themes.Base(primary_hue="orange").set(
401
- body_background_fill="#1a1a1a",
402
  body_text_color="#ffffff",
403
- border_color_accent="#ff4d00",
404
- button_primary_background_fill="#ff4d00",
405
- button_primary_background_fill_hover="#ff6d20",
406
- button_primary_text_color="#ffffff"
 
 
407
  )
408
 
409
- # ==== UI ====
410
  with gr.Blocks(theme=masterbrand_theme, css=custom_css, title="MasterBrand AI Assistant") as demo:
411
- gr.HTML("""
 
412
  <div class="main-header">
413
- <h1>🛍️ MASTERBRAND AI ASSISTANT</h1>
414
  <p>Your Personal E-commerce Business Expert - Available in English & Bulgarian</p>
 
 
 
415
  </div>
416
- """)
 
 
417
 
418
  with gr.Row():
419
  with gr.Column(scale=1):
420
  chatbot = gr.Chatbot(
421
  label="💬 Chat with MasterBrand AI",
422
- height=400,
423
  elem_classes=["chatbot-container"],
424
- type="messages"
 
 
 
425
  )
426
 
427
  inputs = gr.Textbox(
428
- placeholder="Ask me anything about your e-commerce business...",
429
  label="Your Question",
430
- lines=2,
431
- elem_classes=["input-container"]
 
432
  )
433
 
434
  with gr.Row():
@@ -441,12 +317,41 @@ with gr.Blocks(theme=masterbrand_theme, css=custom_css, title="MasterBrand AI As
441
  status_box = gr.Textbox(
442
  label="Status",
443
  interactive=False,
444
- elem_classes=["status-container"]
 
445
  )
446
 
447
- with gr.Accordion("⚙️ Advanced Settings", open=False):
448
- top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="🎯 Creativity (Top-p)", elem_classes=["slider-container"])
449
- temperature = gr.Slider(0.1, 2.0, value=1.0, step=0.1, label="🌡️ Temperature", elem_classes=["slider-container"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
 
451
  # State
452
  state = gr.State([])
@@ -460,5 +365,6 @@ with gr.Blocks(theme=masterbrand_theme, css=custom_css, title="MasterBrand AI As
460
 
461
  # ==== Launch ====
462
  if __name__ == "__main__":
463
- demo.queue(max_size=10).launch()
 
464
 
 
3
  from langdetect import detect
4
  from huggingface_hub import login
5
  import os
6
+ import base64
7
 
8
  login(token=os.getenv("chatbot"))
9
  generator = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.1")
 
31
  2. Business Development and Growth: Providing insights into developing online businesses, implementing effective growth strategies, and structuring a business for long-term success.
32
  3. Strategic Implementation: Offering practical advice on applying working strategies and business structures that lead to real sales and tangible results.
33
  4. Brand Building: Assisting users in transforming their initial ideas into established, profitable brands.
34
+ 5. Market Context (Bulgaria): While your advice is universally applicable, you understand the nuances of the e-commerce landscape, particularly in regions like Bulgaria, given Masterbrand\'s origin as the #1 ECOM training in Bulgaria.
35
  6. Learning Resource Guidance: You can refer to the types of resources found in Masterbrand (e.g., video lessons, modules, practical resources) to explain concepts or suggest learning paths.
36
  Tone and Communication Style:
37
  Your communication should always be:
 
45
  Your knowledge is based on the principles of successful e-commerce as observed and taught by Masterbrand. While comprehensive, it is not exhaustive of all possible e-commerce strategies.
46
  Example Interaction Flow:
47
  User: "I want to start an online store, but I have no idea where to begin."
48
+ Bot: "That\'s a fantastic goal! Many successful e-commerce brands started exactly where you are now. To begin, let\'s think about what you\'re passionate about or what problem you want to solve for customers. This will help us choose a niche. Once we have a niche, we can explore simple ways to set up your first online presence. What kind of products or services are you considering?"
49
  Integration with User Input:
50
+ Always consider the user\'s specific input and tailor your advice accordingly. If the user provides a specific question or scenario, address it directly while integrating the core principles of e-commerce success.
51
  User said:
52
  {user_input_translated}
53
  Give simple, friendly, clear advice:
 
64
  history.append({"role": "assistant", "content": response_text})
65
 
66
  chat_counter += 1
67
+ return history, history, chat_counter, "✅ Success", gr.update(value=\'\'), gr.update(interactive=True)
68
 
69
  def reset_textbox():
70
+ return gr.update(value=\'\', interactive=False), gr.update(interactive=False)
71
+
72
+ # ==== Enhanced Custom CSS with Masterbrand Styling ====
73
+ custom_css = f"""
74
+ @import url(\'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap\');
75
+
76
+ * {{
77
+ font-family: \'Inter\', sans-serif !important;
78
+ }}
79
+
80
+ .gradio-container {{
81
+ background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #2a1a1a 100%) !important;
82
+ min-height: 100vh !important;
83
+ }}
84
+
85
+ .main-header {{
86
+ background: linear-gradient(135deg, #0a0a0a 0%, #1a0a0a 50%, #2a1a1a 100%) !important;
87
+ padding: 3rem 0 !important;
88
+ text-align: center !important;
89
+ border-bottom: 3px solid #ff0000 !important; /* Changed to red */
90
+ margin-bottom: 2rem !important;
91
+ position: relative !important;
92
+ overflow: hidden !important;
93
+ }}
94
+
95
+ .main-header::before {{
96
+ content: \'\';
97
+ position: absolute;
98
+ top: 0;
99
+ left: 0;
100
+ right: 0;
101
+ bottom: 0;
102
+ background: radial-gradient(circle at 50% 50%, rgba(255, 0, 0, 0.1) 0%, transparent 70%); /* Changed to red */
103
+ pointer-events: none;
104
+ }}
105
+
106
+ .logo-container {{
107
+ display: none; /* Removed logo */
108
+ }}
109
+
110
+ .main-header h1 {{
111
+ color: #ffffff !important;
112
+ font-size: 3.5rem !important;
113
+ font-weight: 900 !important;
114
+ text-shadow: 0 0 30px rgba(255, 0, 0, 0.5) !important; /* Changed to red */
115
+ background: linear-gradient(135deg, #ffffff 0%, #ff0000 100%); /* Changed to red */
116
+ -webkit-background-clip: text;
117
+ -webkit-text-fill-color: transparent;
118
+ background-clip: text;
119
+ margin: 0 !important;
120
+ }}
121
+
122
+ .main-header p {{
123
+ color: #cccccc !important;
124
+ font-size: 1.3rem !important;
125
+ font-weight: 500 !important;
126
+ margin-top: 0.5rem !important;
127
+ }}
128
+
129
+ .chatbot-container {{
130
+ background: rgba(26, 26, 26, 0.95) !important;
131
+ border: 2px solid #ff0000 !important; /* Changed to red */
132
+ border-radius: 25px !important;
133
+ box-shadow: 0 15px 40px rgba(255, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important; /* Changed to red */
134
+ margin-bottom: 2rem !important;
135
+ backdrop-filter: blur(10px) !important;
136
+ }}
137
+
138
+ .chatbot-container .message {{
139
+ background: rgba(42, 42, 42, 0.8) !important;
140
+ border-radius: 15px !important;
141
+ margin: 0.5rem 0 !important;
142
+ padding: 1rem !important;
143
+ border-left: 4px solid #ff0000 !important; /* Changed to red */
144
+ }}
145
+
146
+ .input-container {{
147
+ position: relative !important;
148
+ }}
149
+
150
+ .input-container textarea {{
151
+ background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%) !important;
152
+ border: 2px solid #ff0000 !important; /* Changed to red */
153
+ border-radius: 15px !important;
154
+ color: #ffffff !important;
155
+ font-size: 1.1rem !important;
156
+ padding: 1.2rem !important;
157
+ resize: none !important;
158
+ transition: all 0.3s ease !important;
159
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
160
+ }}
161
+
162
+ .input-container textarea:focus {{
163
+ border-color: #ff0000 !important; /* Changed to red */
164
+ box-shadow: 0 0 25px rgba(255, 0, 0, 0.4), 0 5px 15px rgba(0, 0, 0, 0.3) !important; /* Changed to red */
165
+ outline: none !important;
166
+ transform: translateY(-2px) !important;
167
+ }}
168
+
169
+ .input-container textarea::placeholder {{
170
+ color: #888888 !important;
171
+ font-style: italic !important;
172
+ }}
173
+
174
+ .submit-button {{
175
+ background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%) !important; /* Changed to red */
176
+ border: none !important;
177
+ border-radius: 15px !important;
178
+ color: #ffffff !important; /* Changed text color to white for contrast */
179
+ font-size: 1.2rem !important;
180
+ font-weight: 700 !important;
181
+ padding: 1.2rem 2.5rem !important;
182
+ transition: all 0.3s ease !important;
183
+ box-shadow: 0 8px 20px rgba(255, 0, 0, 0.3) !important; /* Changed to red */
184
+ text-transform: uppercase !important;
185
+ letter-spacing: 1px !important;
186
+ }}
187
+
188
+ .submit-button:hover {{
189
+ background: linear-gradient(135deg, #cc0000 0%, #aa0000 100%) !important; /* Changed to red */
190
+ transform: translateY(-3px) !important;
191
+ box-shadow: 0 12px 30px rgba(255, 0, 0, 0.4) !important; /* Changed to red */
192
+ }}
193
+
194
+ .submit-button:active {{
195
+ transform: translateY(-1px) !important;
196
+ }}
197
+
198
+ .accordion-container {{
199
+ background: rgba(26, 26, 26, 0.8) !important;
200
+ border: 1px solid #333333 !important;
201
+ border-radius: 15px !important;
202
+ margin-top: 2rem !important;
203
+ }}
204
+
205
+ .slider-container label {{
206
+ color: #ffffff !important;
207
+ font-weight: 600 !important;
208
+ font-size: 1rem !important;
209
+ }}
210
+
211
+ .slider-container input[type="range"] {{
212
+ accent-color: #ff0000 !important; /* Changed to red */
213
+ }}
214
+
215
+ .status-container textarea {{
216
+ background: transparent !important;
217
+ border: none !important;
218
+ color: #ff0000 !important; /* Changed to red */
219
+ font-weight: 600 !important;
220
+ text-align: center !important;
221
+ }}
222
+
223
+ .footer {{
224
+ display: none !important;
225
+ }}
226
+
227
+ /* Enhanced chat styling */
228
+ .message.user {{
229
+ background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%) !important;
230
+ border-left: 4px solid #ff0000 !important; /* Changed to red */
231
+ margin-left: 2rem !important;
232
+ }}
233
+
234
+ .message.bot {{
235
+ background: linear-gradient(135deg, #1a2a1a 0%, #2a3a2a 100%) !important;
236
+ border-left: 4px solid #cc0000 !important; /* Changed to red */
237
+ margin-right: 2rem !important;
238
+ }}
239
+
240
+ /* Responsive design */
241
+ @media (max-width: 768px) {{
242
+ .main-header h1 {{
243
+ font-size: 2.5rem !important;
244
+ }}
245
+
246
+ .main-header p {{
247
+ font-size: 1.1rem !important;
248
+ }}
249
+ }}
250
+
251
+ /* Animation for logo */
252
+ @keyframes pulse {{
253
+ 0% {{ box-shadow: 0 0 20px rgba(255, 0, 0, 0.3); }}
254
+ 50% {{ box-shadow: 0 0 30px rgba(255, 0, 0, 0.6); }}
255
+ 100% {{ box-shadow: 0 0 20px rgba(255, 0, 0, 0.3); }}
256
+ }}
257
+
258
+ .logo-image {{
259
+ animation: none; /* Removed animation */
260
+ }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  """
262
 
263
+ # ==== Enhanced Theme ====
264
+ masterbrand_theme = gr.themes.Base(primary_hue="red").set( # Changed to red
265
+ body_background_fill="#0a0a0a",
266
  body_text_color="#ffffff",
267
+ border_color_accent="#ff0000", # Changed to red
268
+ button_primary_background_fill="#ff0000", # Changed to red
269
+ button_primary_background_fill_hover="#cc0000", # Changed to red
270
+ button_primary_text_color="#ffffff", # Changed text color to white for contrast
271
+ block_background_fill="#1a1a1a",
272
+ block_border_color="#333333"
273
  )
274
 
275
+ # ==== Enhanced UI ====
276
  with gr.Blocks(theme=masterbrand_theme, css=custom_css, title="MasterBrand AI Assistant") as demo:
277
+ # Enhanced header with no logo
278
+ logo_html = f"""
279
  <div class="main-header">
280
+ <h1>MASTERBRAND AI ASSISTANT</h1>
281
  <p>Your Personal E-commerce Business Expert - Available in English & Bulgarian</p>
282
+ <p style="font-size: 1rem; color: #ff0000; font-weight: 600; margin-top: 1rem;"> /* Changed to red */
283
+ 🚀 Powered by Advanced AI • 🌍 Multilingual Support • 💼 Expert Business Guidance
284
+ </p>
285
  </div>
286
+ """
287
+
288
+ gr.HTML(logo_html)
289
 
290
  with gr.Row():
291
  with gr.Column(scale=1):
292
  chatbot = gr.Chatbot(
293
  label="💬 Chat with MasterBrand AI",
294
+ height=450,
295
  elem_classes=["chatbot-container"],
296
+ type="messages",
297
+ show_label=True,
298
+ container=True,
299
+ show_copy_button=True
300
  )
301
 
302
  inputs = gr.Textbox(
303
+ placeholder="Ask me anything about your e-commerce business... 💡",
304
  label="Your Question",
305
+ lines=3,
306
+ elem_classes=["input-container"],
307
+ show_label=True
308
  )
309
 
310
  with gr.Row():
 
317
  status_box = gr.Textbox(
318
  label="Status",
319
  interactive=False,
320
+ elem_classes=["status-container"],
321
+ show_label=False
322
  )
323
 
324
+ with gr.Accordion("⚙️ Advanced Settings", open=False, elem_classes=["accordion-container"]):
325
+ with gr.Row():
326
+ top_p = gr.Slider(
327
+ 0.1, 1.0,
328
+ value=0.9,
329
+ step=0.05,
330
+ label="🎯 Creativity (Top-p)",
331
+ elem_classes=["slider-container"],
332
+ info="Higher values make responses more creative"
333
+ )
334
+ temperature = gr.Slider(
335
+ 0.1, 2.0,
336
+ value=1.0,
337
+ step=0.1,
338
+ label="🌡️ Temperature",
339
+ elem_classes=["slider-container"],
340
+ info="Controls randomness in responses"
341
+ )
342
+
343
+ # Enhanced footer
344
+ gr.HTML("""
345
+ <div style="text-align: center; padding: 2rem; color: #666666; border-top: 1px solid #333333; margin-top: 3rem;">
346
+ <p style="margin: 0; font-size: 0.9rem;">
347
+ © 2025 MasterBrand AI Assistant • Built with ❤️ for E-commerce Success
348
+ </p>
349
+ <p style="margin: 0.5rem 0 0 0; font-size: 0.8rem; color: #888888;">
350
+ Empowering entrepreneurs worldwide with AI-driven business insights
351
+ </p>
352
+ </div>
353
+ """
354
+ )
355
 
356
  # State
357
  state = gr.State([])
 
365
 
366
  # ==== Launch ====
367
  if __name__ == "__main__":
368
+ demo.queue(max_size=10).launch(server_name="0.0.0.0", server_port=7860)
369
+
370