Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,53 +98,91 @@ def generate_response(user_input, top_p, temperature, chat_counter, chatbot, his
|
|
| 98 |
def reset_textbox():
|
| 99 |
return gr.update(value='')
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
# ==== Enhanced Custom CSS with Masterbrand Styling ====
|
| 102 |
custom_css = f"""
|
| 103 |
-
@import url(
|
| 104 |
|
| 105 |
* {{
|
| 106 |
-
font-family:
|
| 107 |
}}
|
| 108 |
|
| 109 |
.gradio-container {{
|
| 110 |
-
background: linear-gradient(135deg, #0a0a0a 0%, #
|
| 111 |
min-height: 100vh !important;
|
| 112 |
}}
|
| 113 |
|
| 114 |
.main-header {{
|
| 115 |
background: linear-gradient(135deg, #0a0a0a 0%, #1a0a0a 50%, #2a1a1a 100%) !important;
|
| 116 |
-
padding: 3rem 0 !important;
|
| 117 |
text-align: center !important;
|
| 118 |
-
border-bottom: 3px solid #ff0000 !important;
|
| 119 |
margin-bottom: 2rem !important;
|
| 120 |
position: relative !important;
|
| 121 |
overflow: hidden !important;
|
| 122 |
}}
|
| 123 |
|
| 124 |
.main-header::before {{
|
| 125 |
-
content:
|
| 126 |
position: absolute;
|
| 127 |
top: 0;
|
| 128 |
left: 0;
|
| 129 |
right: 0;
|
| 130 |
bottom: 0;
|
| 131 |
-
background: radial-gradient(circle at 50% 50%, rgba(255, 0, 0, 0.1) 0%, transparent 70%);
|
| 132 |
pointer-events: none;
|
| 133 |
}}
|
| 134 |
|
| 135 |
.logo-container {{
|
| 136 |
-
display:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
}}
|
| 138 |
|
| 139 |
.main-header h1 {{
|
| 140 |
color: #ffffff !important;
|
| 141 |
font-size: 3.5rem !important;
|
| 142 |
font-weight: 900 !important;
|
| 143 |
-
text-shadow: 0 0 30px rgba(255, 0, 0, 0.5) !important;
|
| 144 |
-
background: linear-gradient(135deg, #ffffff 0%, #ff0000 100%);
|
| 145 |
-
-webkit-background-clip: text;
|
| 146 |
-
-webkit-text-fill-color: transparent;
|
| 147 |
-
background-clip: text;
|
| 148 |
margin: 0 !important;
|
| 149 |
}}
|
| 150 |
|
|
@@ -157,67 +195,137 @@ custom_css = f"""
|
|
| 157 |
|
| 158 |
.chatbot-container {{
|
| 159 |
background: rgba(26, 26, 26, 0.95) !important;
|
| 160 |
-
border: 2px solid #ff0000 !important;
|
| 161 |
border-radius: 25px !important;
|
| 162 |
-
box-shadow: 0 15px 40px rgba(255, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
|
| 163 |
margin-bottom: 2rem !important;
|
| 164 |
backdrop-filter: blur(10px) !important;
|
| 165 |
}}
|
| 166 |
|
| 167 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
background: rgba(42, 42, 42, 0.8) !important;
|
|
|
|
| 169 |
border-radius: 15px !important;
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
}}
|
| 174 |
|
| 175 |
-
.input-
|
| 176 |
-
|
|
|
|
| 177 |
}}
|
| 178 |
|
| 179 |
-
.input
|
| 180 |
background: linear-gradient(135deg, #1a1a1a 0%, #2a2a1a 100%) !important;
|
| 181 |
-
border: 2px solid #
|
| 182 |
border-radius: 15px !important;
|
| 183 |
color: #ffffff !important;
|
| 184 |
font-size: 1.1rem !important;
|
| 185 |
padding: 1.2rem !important;
|
| 186 |
-
resize: none !important;
|
| 187 |
transition: all 0.3s ease !important;
|
| 188 |
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
|
| 189 |
}}
|
| 190 |
|
| 191 |
-
.input
|
| 192 |
-
border-color: #ff0000 !important;
|
| 193 |
-
box-shadow: 0 0 25px rgba(255, 0, 0, 0.4), 0 5px 15px rgba(0, 0, 0, 0.3) !important;
|
| 194 |
outline: none !important;
|
| 195 |
transform: translateY(-2px) !important;
|
| 196 |
}}
|
| 197 |
|
| 198 |
-
.input
|
| 199 |
color: #888888 !important;
|
| 200 |
font-style: italic !important;
|
| 201 |
}}
|
| 202 |
|
| 203 |
.submit-button {{
|
| 204 |
-
background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%) !important;
|
| 205 |
border: none !important;
|
| 206 |
border-radius: 15px !important;
|
| 207 |
-
color: #ffffff !important;
|
| 208 |
font-size: 1.2rem !important;
|
| 209 |
font-weight: 700 !important;
|
| 210 |
padding: 1.2rem 2.5rem !important;
|
| 211 |
transition: all 0.3s ease !important;
|
| 212 |
-
box-shadow: 0 8px 20px rgba(255, 0, 0, 0.3) !important;
|
| 213 |
text-transform: uppercase !important;
|
| 214 |
letter-spacing: 1px !important;
|
|
|
|
|
|
|
| 215 |
}}
|
| 216 |
|
| 217 |
.submit-button:hover {{
|
| 218 |
-
background: linear-gradient(135deg, #cc0000 0%, #aa0000 100%) !important;
|
| 219 |
transform: translateY(-3px) !important;
|
| 220 |
-
box-shadow: 0 12px 30px rgba(255, 0, 0, 0.4) !important;
|
| 221 |
}}
|
| 222 |
|
| 223 |
.submit-button:active {{
|
|
@@ -238,13 +346,13 @@ custom_css = f"""
|
|
| 238 |
}}
|
| 239 |
|
| 240 |
.slider-container input[type="range"] {{
|
| 241 |
-
accent-color: #ff0000 !important;
|
| 242 |
}}
|
| 243 |
|
| 244 |
.status-container textarea {{
|
| 245 |
background: transparent !important;
|
| 246 |
border: none !important;
|
| 247 |
-
color: #ff0000 !important;
|
| 248 |
font-weight: 600 !important;
|
| 249 |
text-align: center !important;
|
| 250 |
}}
|
|
@@ -256,13 +364,13 @@ custom_css = f"""
|
|
| 256 |
/* Enhanced chat styling */
|
| 257 |
.message.user {{
|
| 258 |
background: linear-gradient(135deg, #2a2a2a 0%, #3a3a2a 100%) !important;
|
| 259 |
-
border-left: 4px solid #ff0000 !important;
|
| 260 |
margin-left: 2rem !important;
|
| 261 |
}}
|
| 262 |
|
| 263 |
.message.bot {{
|
| 264 |
background: linear-gradient(135deg, #1a2a1a 0%, #2a3a2a 100%) !important;
|
| 265 |
-
border-left: 4px solid #cc0000 !important;
|
| 266 |
margin-right: 2rem !important;
|
| 267 |
}}
|
| 268 |
|
|
@@ -275,40 +383,67 @@ custom_css = f"""
|
|
| 275 |
.main-header p {{
|
| 276 |
font-size: 1.1rem !important;
|
| 277 |
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
}}
|
| 279 |
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
50% {{ box-shadow: 0 0 30px rgba(255, 0, 0, 0.6); }}
|
| 284 |
-
100% {{ box-shadow: 0 0 20px rgba(255, 0, 0, 0.3); }}
|
| 285 |
}}
|
| 286 |
|
| 287 |
-
.
|
| 288 |
-
animation:
|
| 289 |
}}
|
| 290 |
"""
|
| 291 |
|
| 292 |
# ==== Enhanced Theme ====
|
| 293 |
-
masterbrand_theme = gr.themes.Base(primary_hue="red").set(
|
| 294 |
body_background_fill="#0a0a0a",
|
| 295 |
body_text_color="#ffffff",
|
| 296 |
-
border_color_accent="#ff0000",
|
| 297 |
-
button_primary_background_fill="#ff0000",
|
| 298 |
-
button_primary_background_fill_hover="#cc0000",
|
| 299 |
-
button_primary_text_color="#ffffff",
|
| 300 |
block_background_fill="#1a1a1a",
|
| 301 |
block_border_color="#333333"
|
| 302 |
)
|
| 303 |
|
| 304 |
# ==== Enhanced UI ====
|
| 305 |
with gr.Blocks(theme=masterbrand_theme, css=custom_css, title="MasterBrand AI Assistant") as demo:
|
| 306 |
-
# Enhanced header with
|
| 307 |
logo_html = f"""
|
| 308 |
<div class="main-header">
|
| 309 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
<p>Your Personal E-commerce Business Expert - Available in English & Bulgarian</p>
|
| 311 |
-
<p style="font-size: 1rem; color: #ff0000; font-weight: 600; margin-top: 1rem;">
|
| 312 |
π Powered by Advanced AI β’ π Multilingual Support β’ πΌ Expert Business Guidance
|
| 313 |
</p>
|
| 314 |
</div>
|
|
@@ -328,26 +463,51 @@ with gr.Blocks(theme=masterbrand_theme, css=custom_css, title="MasterBrand AI As
|
|
| 328 |
show_copy_button=True
|
| 329 |
)
|
| 330 |
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
label="Your Question
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
url_input = gr.Textbox(label="Paste a URL (optional)", placeholder="https://example.com")
|
| 342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
|
| 344 |
-
with gr.Row():
|
| 345 |
submit_btn = gr.Button(
|
| 346 |
"π Get Expert Advice",
|
| 347 |
variant="primary",
|
| 348 |
size="lg",
|
| 349 |
elem_classes=["submit-button"]
|
| 350 |
)
|
|
|
|
|
|
|
| 351 |
status_box = gr.Textbox(
|
| 352 |
label="Status",
|
| 353 |
interactive=False,
|
|
@@ -411,5 +571,3 @@ with gr.Blocks(theme=masterbrand_theme, css=custom_css, title="MasterBrand AI As
|
|
| 411 |
if __name__ == "__main__":
|
| 412 |
demo.queue(max_size=10).launch(server_name="0.0.0.0", server_port=7860)
|
| 413 |
|
| 414 |
-
|
| 415 |
-
|
|
|
|
| 98 |
def reset_textbox():
|
| 99 |
return gr.update(value='')
|
| 100 |
|
| 101 |
+
# Convert logo to base64
|
| 102 |
+
def get_logo_base64():
|
| 103 |
+
try:
|
| 104 |
+
with open("/home/ubuntu/masterbrand_logo.jpg", "rb") as img_file:
|
| 105 |
+
return base64.b64encode(img_file.read()).decode()
|
| 106 |
+
except:
|
| 107 |
+
return ""
|
| 108 |
+
|
| 109 |
+
logo_base64 = get_logo_base64()
|
| 110 |
+
|
| 111 |
# ==== Enhanced Custom CSS with Masterbrand Styling ====
|
| 112 |
custom_css = f"""
|
| 113 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
|
| 114 |
|
| 115 |
* {{
|
| 116 |
+
font-family: 'Inter', sans-serif !important;
|
| 117 |
}}
|
| 118 |
|
| 119 |
.gradio-container {{
|
| 120 |
+
background: linear-gradient(135deg, #0a0a0a 0%, #1a0a0a 50%, #2a1a1a 100%) !important;
|
| 121 |
min-height: 100vh !important;
|
| 122 |
}}
|
| 123 |
|
| 124 |
.main-header {{
|
| 125 |
background: linear-gradient(135deg, #0a0a0a 0%, #1a0a0a 50%, #2a1a1a 100%) !important;
|
| 126 |
+
padding: 2rem 0 3rem 0 !important;
|
| 127 |
text-align: center !important;
|
| 128 |
+
border-bottom: 3px solid #ff0000 !important;
|
| 129 |
margin-bottom: 2rem !important;
|
| 130 |
position: relative !important;
|
| 131 |
overflow: hidden !important;
|
| 132 |
}}
|
| 133 |
|
| 134 |
.main-header::before {{
|
| 135 |
+
content: '';
|
| 136 |
position: absolute;
|
| 137 |
top: 0;
|
| 138 |
left: 0;
|
| 139 |
right: 0;
|
| 140 |
bottom: 0;
|
| 141 |
+
background: radial-gradient(circle at 50% 50%, rgba(255, 0, 0, 0.1) 0%, transparent 70%);
|
| 142 |
pointer-events: none;
|
| 143 |
}}
|
| 144 |
|
| 145 |
.logo-container {{
|
| 146 |
+
display: flex !important;
|
| 147 |
+
justify-content: center !important;
|
| 148 |
+
align-items: center !important;
|
| 149 |
+
margin-bottom: 1.5rem !important;
|
| 150 |
+
gap: 1rem !important;
|
| 151 |
+
}}
|
| 152 |
+
|
| 153 |
+
.logo-image {{
|
| 154 |
+
width: 80px !important;
|
| 155 |
+
height: 80px !important;
|
| 156 |
+
border-radius: 15px !important;
|
| 157 |
+
box-shadow: 0 0 30px rgba(255, 0, 0, 0.5) !important;
|
| 158 |
+
animation: pulse-glow 2s ease-in-out infinite alternate !important;
|
| 159 |
+
transition: transform 0.3s ease !important;
|
| 160 |
+
}}
|
| 161 |
+
|
| 162 |
+
.logo-image:hover {{
|
| 163 |
+
transform: scale(1.1) !important;
|
| 164 |
+
}}
|
| 165 |
+
|
| 166 |
+
.brand-text {{
|
| 167 |
+
background: linear-gradient(135deg, #00ff41 0%, #ffffff 50%, #ff0000 100%) !important;
|
| 168 |
+
-webkit-background-clip: text !important;
|
| 169 |
+
-webkit-text-fill-color: transparent !important;
|
| 170 |
+
background-clip: text !important;
|
| 171 |
+
font-size: 2.5rem !important;
|
| 172 |
+
font-weight: 900 !important;
|
| 173 |
+
letter-spacing: 2px !important;
|
| 174 |
+
text-shadow: 0 0 20px rgba(0, 255, 65, 0.3) !important;
|
| 175 |
}}
|
| 176 |
|
| 177 |
.main-header h1 {{
|
| 178 |
color: #ffffff !important;
|
| 179 |
font-size: 3.5rem !important;
|
| 180 |
font-weight: 900 !important;
|
| 181 |
+
text-shadow: 0 0 30px rgba(255, 0, 0, 0.5) !important;
|
| 182 |
+
background: linear-gradient(135deg, #ffffff 0%, #ff0000 100%) !important;
|
| 183 |
+
-webkit-background-clip: text !important;
|
| 184 |
+
-webkit-text-fill-color: transparent !important;
|
| 185 |
+
background-clip: text !important;
|
| 186 |
margin: 0 !important;
|
| 187 |
}}
|
| 188 |
|
|
|
|
| 195 |
|
| 196 |
.chatbot-container {{
|
| 197 |
background: rgba(26, 26, 26, 0.95) !important;
|
| 198 |
+
border: 2px solid #ff0000 !important;
|
| 199 |
border-radius: 25px !important;
|
| 200 |
+
box-shadow: 0 15px 40px rgba(255, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
|
| 201 |
margin-bottom: 2rem !important;
|
| 202 |
backdrop-filter: blur(10px) !important;
|
| 203 |
}}
|
| 204 |
|
| 205 |
+
.input-section {{
|
| 206 |
+
background: rgba(26, 26, 26, 0.8) !important;
|
| 207 |
+
border: 2px solid #333333 !important;
|
| 208 |
+
border-radius: 20px !important;
|
| 209 |
+
padding: 2rem !important;
|
| 210 |
+
margin: 1rem 0 !important;
|
| 211 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
|
| 212 |
+
backdrop-filter: blur(10px) !important;
|
| 213 |
+
transition: all 0.3s ease !important;
|
| 214 |
+
}}
|
| 215 |
+
|
| 216 |
+
.input-section:hover {{
|
| 217 |
+
border-color: #ff0000 !important;
|
| 218 |
+
box-shadow: 0 15px 40px rgba(255, 0, 0, 0.2) !important;
|
| 219 |
+
}}
|
| 220 |
+
|
| 221 |
+
.input-group {{
|
| 222 |
+
margin-bottom: 1.5rem !important;
|
| 223 |
+
}}
|
| 224 |
+
|
| 225 |
+
.input-group:last-child {{
|
| 226 |
+
margin-bottom: 0 !important;
|
| 227 |
+
}}
|
| 228 |
+
|
| 229 |
+
.input-label {{
|
| 230 |
+
color: #ffffff !important;
|
| 231 |
+
font-size: 1.1rem !important;
|
| 232 |
+
font-weight: 600 !important;
|
| 233 |
+
margin-bottom: 0.8rem !important;
|
| 234 |
+
display: flex !important;
|
| 235 |
+
align-items: center !important;
|
| 236 |
+
gap: 0.5rem !important;
|
| 237 |
+
}}
|
| 238 |
+
|
| 239 |
+
.input-icon {{
|
| 240 |
+
font-size: 1.2rem !important;
|
| 241 |
+
color: #ff0000 !important;
|
| 242 |
+
}}
|
| 243 |
+
|
| 244 |
+
.enhanced-textbox textarea {{
|
| 245 |
+
background: linear-gradient(135deg, #1a1a1a 0%, #2a2a1a 100%) !important;
|
| 246 |
+
border: 2px solid #444444 !important;
|
| 247 |
+
border-radius: 15px !important;
|
| 248 |
+
color: #ffffff !important;
|
| 249 |
+
font-size: 1.1rem !important;
|
| 250 |
+
padding: 1.2rem !important;
|
| 251 |
+
resize: none !important;
|
| 252 |
+
transition: all 0.3s ease !important;
|
| 253 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
|
| 254 |
+
}}
|
| 255 |
+
|
| 256 |
+
.enhanced-textbox textarea:focus {{
|
| 257 |
+
border-color: #ff0000 !important;
|
| 258 |
+
box-shadow: 0 0 25px rgba(255, 0, 0, 0.4), 0 5px 15px rgba(0, 0, 0, 0.3) !important;
|
| 259 |
+
outline: none !important;
|
| 260 |
+
transform: translateY(-2px) !important;
|
| 261 |
+
}}
|
| 262 |
+
|
| 263 |
+
.enhanced-textbox textarea::placeholder {{
|
| 264 |
+
color: #888888 !important;
|
| 265 |
+
font-style: italic !important;
|
| 266 |
+
}}
|
| 267 |
+
|
| 268 |
+
.enhanced-image-input, .enhanced-video-input {{
|
| 269 |
background: rgba(42, 42, 42, 0.8) !important;
|
| 270 |
+
border: 2px dashed #444444 !important;
|
| 271 |
border-radius: 15px !important;
|
| 272 |
+
padding: 2rem !important;
|
| 273 |
+
text-align: center !important;
|
| 274 |
+
transition: all 0.3s ease !important;
|
| 275 |
+
min-height: 120px !important;
|
| 276 |
+
display: flex !important;
|
| 277 |
+
align-items: center !important;
|
| 278 |
+
justify-content: center !important;
|
| 279 |
}}
|
| 280 |
|
| 281 |
+
.enhanced-image-input:hover, .enhanced-video-input:hover {{
|
| 282 |
+
border-color: #ff0000 !important;
|
| 283 |
+
background: rgba(255, 0, 0, 0.05) !important;
|
| 284 |
}}
|
| 285 |
|
| 286 |
+
.enhanced-url-input input {{
|
| 287 |
background: linear-gradient(135deg, #1a1a1a 0%, #2a2a1a 100%) !important;
|
| 288 |
+
border: 2px solid #444444 !important;
|
| 289 |
border-radius: 15px !important;
|
| 290 |
color: #ffffff !important;
|
| 291 |
font-size: 1.1rem !important;
|
| 292 |
padding: 1.2rem !important;
|
|
|
|
| 293 |
transition: all 0.3s ease !important;
|
| 294 |
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
|
| 295 |
}}
|
| 296 |
|
| 297 |
+
.enhanced-url-input input:focus {{
|
| 298 |
+
border-color: #ff0000 !important;
|
| 299 |
+
box-shadow: 0 0 25px rgba(255, 0, 0, 0.4), 0 5px 15px rgba(0, 0, 0, 0.3) !important;
|
| 300 |
outline: none !important;
|
| 301 |
transform: translateY(-2px) !important;
|
| 302 |
}}
|
| 303 |
|
| 304 |
+
.enhanced-url-input input::placeholder {{
|
| 305 |
color: #888888 !important;
|
| 306 |
font-style: italic !important;
|
| 307 |
}}
|
| 308 |
|
| 309 |
.submit-button {{
|
| 310 |
+
background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%) !important;
|
| 311 |
border: none !important;
|
| 312 |
border-radius: 15px !important;
|
| 313 |
+
color: #ffffff !important;
|
| 314 |
font-size: 1.2rem !important;
|
| 315 |
font-weight: 700 !important;
|
| 316 |
padding: 1.2rem 2.5rem !important;
|
| 317 |
transition: all 0.3s ease !important;
|
| 318 |
+
box-shadow: 0 8px 20px rgba(255, 0, 0, 0.3) !important;
|
| 319 |
text-transform: uppercase !important;
|
| 320 |
letter-spacing: 1px !important;
|
| 321 |
+
width: 100% !important;
|
| 322 |
+
margin-top: 1rem !important;
|
| 323 |
}}
|
| 324 |
|
| 325 |
.submit-button:hover {{
|
| 326 |
+
background: linear-gradient(135deg, #cc0000 0%, #aa0000 100%) !important;
|
| 327 |
transform: translateY(-3px) !important;
|
| 328 |
+
box-shadow: 0 12px 30px rgba(255, 0, 0, 0.4) !important;
|
| 329 |
}}
|
| 330 |
|
| 331 |
.submit-button:active {{
|
|
|
|
| 346 |
}}
|
| 347 |
|
| 348 |
.slider-container input[type="range"] {{
|
| 349 |
+
accent-color: #ff0000 !important;
|
| 350 |
}}
|
| 351 |
|
| 352 |
.status-container textarea {{
|
| 353 |
background: transparent !important;
|
| 354 |
border: none !important;
|
| 355 |
+
color: #ff0000 !important;
|
| 356 |
font-weight: 600 !important;
|
| 357 |
text-align: center !important;
|
| 358 |
}}
|
|
|
|
| 364 |
/* Enhanced chat styling */
|
| 365 |
.message.user {{
|
| 366 |
background: linear-gradient(135deg, #2a2a2a 0%, #3a3a2a 100%) !important;
|
| 367 |
+
border-left: 4px solid #ff0000 !important;
|
| 368 |
margin-left: 2rem !important;
|
| 369 |
}}
|
| 370 |
|
| 371 |
.message.bot {{
|
| 372 |
background: linear-gradient(135deg, #1a2a1a 0%, #2a3a2a 100%) !important;
|
| 373 |
+
border-left: 4px solid #cc0000 !important;
|
| 374 |
margin-right: 2rem !important;
|
| 375 |
}}
|
| 376 |
|
|
|
|
| 383 |
.main-header p {{
|
| 384 |
font-size: 1.1rem !important;
|
| 385 |
}}
|
| 386 |
+
|
| 387 |
+
.logo-image {{
|
| 388 |
+
width: 60px !important;
|
| 389 |
+
height: 60px !important;
|
| 390 |
+
}}
|
| 391 |
+
|
| 392 |
+
.brand-text {{
|
| 393 |
+
font-size: 2rem !important;
|
| 394 |
+
}}
|
| 395 |
+
}}
|
| 396 |
+
|
| 397 |
+
/* Animations */
|
| 398 |
+
@keyframes pulse-glow {{
|
| 399 |
+
0% {{
|
| 400 |
+
box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
|
| 401 |
+
transform: scale(1);
|
| 402 |
+
}}
|
| 403 |
+
50% {{
|
| 404 |
+
box-shadow: 0 0 40px rgba(255, 0, 0, 0.6);
|
| 405 |
+
transform: scale(1.02);
|
| 406 |
+
}}
|
| 407 |
+
100% {{
|
| 408 |
+
box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
|
| 409 |
+
transform: scale(1);
|
| 410 |
+
}}
|
| 411 |
}}
|
| 412 |
|
| 413 |
+
@keyframes float {{
|
| 414 |
+
0%, 100% {{ transform: translateY(0px); }}
|
| 415 |
+
50% {{ transform: translateY(-10px); }}
|
|
|
|
|
|
|
| 416 |
}}
|
| 417 |
|
| 418 |
+
.floating {{
|
| 419 |
+
animation: float 3s ease-in-out infinite;
|
| 420 |
}}
|
| 421 |
"""
|
| 422 |
|
| 423 |
# ==== Enhanced Theme ====
|
| 424 |
+
masterbrand_theme = gr.themes.Base(primary_hue="red").set(
|
| 425 |
body_background_fill="#0a0a0a",
|
| 426 |
body_text_color="#ffffff",
|
| 427 |
+
border_color_accent="#ff0000",
|
| 428 |
+
button_primary_background_fill="#ff0000",
|
| 429 |
+
button_primary_background_fill_hover="#cc0000",
|
| 430 |
+
button_primary_text_color="#ffffff",
|
| 431 |
block_background_fill="#1a1a1a",
|
| 432 |
block_border_color="#333333"
|
| 433 |
)
|
| 434 |
|
| 435 |
# ==== Enhanced UI ====
|
| 436 |
with gr.Blocks(theme=masterbrand_theme, css=custom_css, title="MasterBrand AI Assistant") as demo:
|
| 437 |
+
# Enhanced header with logo
|
| 438 |
logo_html = f"""
|
| 439 |
<div class="main-header">
|
| 440 |
+
<div class="logo-container">
|
| 441 |
+
<img src="data:image/jpeg;base64,{logo_base64}" alt="MasterBrand Logo" class="logo-image floating">
|
| 442 |
+
<div class="brand-text">MASTERBRAND</div>
|
| 443 |
+
</div>
|
| 444 |
+
<h1>AI ASSISTANT</h1>
|
| 445 |
<p>Your Personal E-commerce Business Expert - Available in English & Bulgarian</p>
|
| 446 |
+
<p style="font-size: 1rem; color: #ff0000; font-weight: 600; margin-top: 1rem;">
|
| 447 |
π Powered by Advanced AI β’ π Multilingual Support β’ πΌ Expert Business Guidance
|
| 448 |
</p>
|
| 449 |
</div>
|
|
|
|
| 463 |
show_copy_button=True
|
| 464 |
)
|
| 465 |
|
| 466 |
+
# Enhanced Input Section
|
| 467 |
+
with gr.Column(elem_classes=["input-section"]):
|
| 468 |
+
gr.HTML('<div class="input-label"><span class="input-icon">π¬</span>Ask Your Question</div>')
|
| 469 |
+
inputs = gr.Textbox(
|
| 470 |
+
placeholder="Ask me anything about your e-commerce business... π‘",
|
| 471 |
+
label="",
|
| 472 |
+
lines=3,
|
| 473 |
+
elem_classes=["enhanced-textbox"],
|
| 474 |
+
show_label=False
|
| 475 |
+
)
|
|
|
|
| 476 |
|
| 477 |
+
with gr.Row():
|
| 478 |
+
with gr.Column():
|
| 479 |
+
gr.HTML('<div class="input-label"><span class="input-icon">πΌοΈ</span>Upload Image (Optional)</div>')
|
| 480 |
+
image_input = gr.Image(
|
| 481 |
+
label="",
|
| 482 |
+
type="pil",
|
| 483 |
+
elem_classes=["enhanced-image-input"],
|
| 484 |
+
show_label=False
|
| 485 |
+
)
|
| 486 |
+
|
| 487 |
+
with gr.Column():
|
| 488 |
+
gr.HTML('<div class="input-label"><span class="input-icon">π₯</span>Upload Video (Optional)</div>')
|
| 489 |
+
video_input = gr.Video(
|
| 490 |
+
label="",
|
| 491 |
+
elem_classes=["enhanced-video-input"],
|
| 492 |
+
show_label=False
|
| 493 |
+
)
|
| 494 |
+
|
| 495 |
+
gr.HTML('<div class="input-label"><span class="input-icon">π</span>Paste URL (Optional)</div>')
|
| 496 |
+
url_input = gr.Textbox(
|
| 497 |
+
label="",
|
| 498 |
+
placeholder="https://example.com - Paste any URL for analysis",
|
| 499 |
+
elem_classes=["enhanced-url-input"],
|
| 500 |
+
show_label=False
|
| 501 |
+
)
|
| 502 |
|
|
|
|
| 503 |
submit_btn = gr.Button(
|
| 504 |
"π Get Expert Advice",
|
| 505 |
variant="primary",
|
| 506 |
size="lg",
|
| 507 |
elem_classes=["submit-button"]
|
| 508 |
)
|
| 509 |
+
|
| 510 |
+
with gr.Row():
|
| 511 |
status_box = gr.Textbox(
|
| 512 |
label="Status",
|
| 513 |
interactive=False,
|
|
|
|
| 571 |
if __name__ == "__main__":
|
| 572 |
demo.queue(max_size=10).launch(server_name="0.0.0.0", server_port=7860)
|
| 573 |
|
|
|
|
|
|