Update scripts/main.py
Browse files- scripts/main.py +131 -349
scripts/main.py
CHANGED
|
@@ -3,15 +3,12 @@ import google.generativeai as genai
|
|
| 3 |
import os
|
| 4 |
from typing import List, Dict
|
| 5 |
|
| 6 |
-
class
|
| 7 |
def __init__(self):
|
| 8 |
-
"""Clean, professional 4AT chatbot"""
|
| 9 |
self.setup_api()
|
| 10 |
self.knowledge_base = self.load_knowledge()
|
| 11 |
-
print(f"🤖 4AT Assistant ready")
|
| 12 |
|
| 13 |
def setup_api(self):
|
| 14 |
-
"""Setup Google AI with fallback"""
|
| 15 |
self.api_working = False
|
| 16 |
try:
|
| 17 |
api_key = os.environ.get("GOOGLE_API_KEY")
|
|
@@ -24,77 +21,30 @@ class Clean4ATChatbot:
|
|
| 24 |
pass
|
| 25 |
|
| 26 |
def load_knowledge(self) -> Dict[str, str]:
|
| 27 |
-
"""Clean, concise knowledge base"""
|
| 28 |
return {
|
| 29 |
-
"about": "
|
| 30 |
|
| 31 |
-
"services": "
|
| 32 |
|
| 33 |
-
|
| 34 |
-
• Accounting Process Outsourcing (APO)
|
| 35 |
-
• SOX Compliance & Internal Controls
|
| 36 |
-
• Technical Accounting & SEC Reporting
|
| 37 |
-
• Audit Outsourcing & Readiness
|
| 38 |
-
• Tax Advisory & IPO Readiness
|
| 39 |
|
| 40 |
-
|
| 41 |
-
• Cloud Services (AWS, Azure, GCP)
|
| 42 |
-
• Cyber Security & Data Analytics
|
| 43 |
-
• Robotic Process Automation (RPA)
|
| 44 |
|
| 45 |
-
|
| 46 |
-
• 4AT Academy (CPA, CMA, IFRS, SOX training)""",
|
| 47 |
|
| 48 |
-
"
|
| 49 |
-
|
| 50 |
-
**Managing Partners:**
|
| 51 |
-
• **Ravi Krovvidi** - 20+ years Finance & Accounting, global experience
|
| 52 |
-
• **Aruna Sharma** - 15+ years public accounting, Chartered Accountant, Big 4 background
|
| 53 |
-
|
| 54 |
-
**Key Leaders:**
|
| 55 |
-
• **Chetana RG Kaasam** - Corporate Governance expert, Georgetown & LSE
|
| 56 |
-
• **Srigouri Mantrala** - 24+ years, Big Four SOX expert
|
| 57 |
-
• **D Satish Kumar** - 15+ years Fortune 500 experience""",
|
| 58 |
-
|
| 59 |
-
"clients": """**4AT Clients:**
|
| 60 |
-
|
| 61 |
-
**Major Clients:** Deloitte, BDO, SENSIBA SAN FILIPPO, BPM, AEMETIS, TeamLease, Bharat Group
|
| 62 |
-
|
| 63 |
-
**Track Record:**
|
| 64 |
-
• 45+ successful projects across 3 countries
|
| 65 |
-
• 100% SOX deadline achievement
|
| 66 |
-
• Zero audit delays for client engagements
|
| 67 |
-
|
| 68 |
-
*"4AT was quite a game changer... managed operations with utmost diligence."* - Client Testimonial""",
|
| 69 |
-
|
| 70 |
-
"contact": """**Contact 4AT:**
|
| 71 |
-
|
| 72 |
-
**🇺🇸 USA:** Princeton, NJ | +1 703 665 4255
|
| 73 |
-
**🇮🇳 India:** Hyderabad, TS | +91 9010433456
|
| 74 |
-
**🇦🇺 Australia:** Sydney, NSW
|
| 75 |
-
**📧 Email:** info@consult-4at.com
|
| 76 |
-
|
| 77 |
-
Global 24/7 service delivery""",
|
| 78 |
-
|
| 79 |
-
"experience": """**4AT Background:**
|
| 80 |
-
|
| 81 |
-
• Big 4 heritage with 100+ years combined expertise
|
| 82 |
-
• Global operations across USA, India, Australia
|
| 83 |
-
• 45+ projects with 100% client satisfaction
|
| 84 |
-
• Proven Build-Operate-Transfer methodology""",
|
| 85 |
}
|
| 86 |
|
| 87 |
def detect_intent(self, query: str) -> str:
|
| 88 |
-
|
| 89 |
-
q = query.lower().strip()
|
| 90 |
|
| 91 |
-
if any(word in q for word in ["client", "customer", "
|
| 92 |
return "clients"
|
| 93 |
-
elif any(word in q for word in ["founder", "partner", "team", "leadership", "ravi", "aruna"
|
| 94 |
return "leadership"
|
| 95 |
-
elif any(word in q for word in ["service", "offer", "provide", "do", "help", "sox", "audit", "accounting"
|
| 96 |
return "services"
|
| 97 |
-
elif any(word in q for word in ["contact", "phone", "email", "address", "location", "office"
|
| 98 |
return "contact"
|
| 99 |
elif any(word in q for word in ["when", "start", "establish", "history", "experience", "background"]):
|
| 100 |
return "experience"
|
|
@@ -102,375 +52,207 @@ Global 24/7 service delivery""",
|
|
| 102 |
return "about"
|
| 103 |
|
| 104 |
def generate_response(self, query: str, history: List = None) -> str:
|
| 105 |
-
"""Generate clean, professional responses"""
|
| 106 |
intent = self.detect_intent(query)
|
| 107 |
context = self.knowledge_base[intent]
|
| 108 |
|
| 109 |
if self.api_working:
|
| 110 |
try:
|
| 111 |
-
prompt = f"
|
| 112 |
-
|
| 113 |
-
User: "{query}"
|
| 114 |
-
Information: {context}
|
| 115 |
-
|
| 116 |
-
Response:"""
|
| 117 |
response = self.model.generate_content(prompt)
|
| 118 |
return response.text
|
| 119 |
except:
|
| 120 |
pass
|
| 121 |
|
| 122 |
-
|
| 123 |
-
if intent == "clients":
|
| 124 |
-
return f"""{context}
|
| 125 |
-
|
| 126 |
-
Want to know more about our services or discuss your needs?"""
|
| 127 |
-
elif intent == "leadership":
|
| 128 |
-
return f"""{context}
|
| 129 |
|
| 130 |
-
|
| 131 |
-
elif intent == "services":
|
| 132 |
-
return f"""{context}
|
| 133 |
-
|
| 134 |
-
Interested in a specific service? I can provide more details."""
|
| 135 |
-
elif intent == "contact":
|
| 136 |
-
return f"""{context}
|
| 137 |
-
|
| 138 |
-
Ready to discuss your needs? Our team is available 24/7."""
|
| 139 |
-
elif intent == "experience":
|
| 140 |
-
return f"""{context}
|
| 141 |
-
|
| 142 |
-
Want to learn about our expertise in your industry?"""
|
| 143 |
-
else:
|
| 144 |
-
return f"""{context}
|
| 145 |
-
|
| 146 |
-
Ask me about our services, team, clients, or how we can help!"""
|
| 147 |
-
|
| 148 |
-
# Initialize chatbot
|
| 149 |
-
chatbot = Clean4ATChatbot()
|
| 150 |
|
| 151 |
def chat_function(message, history):
|
| 152 |
-
"""Clean chat function"""
|
| 153 |
try:
|
| 154 |
return chatbot.generate_response(message, history)
|
| 155 |
except:
|
| 156 |
-
return "
|
| 157 |
|
| 158 |
-
#
|
| 159 |
-
|
| 160 |
-
/*
|
| 161 |
.gradio-container {
|
| 162 |
-
background: #
|
| 163 |
-
color: #
|
| 164 |
-
font-family: -
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
/* Remove all unnecessary padding and margins */
|
| 168 |
-
.gradio-container > div {
|
| 169 |
-
background: transparent !important;
|
| 170 |
-
padding: 0 !important;
|
| 171 |
-
margin: 0 !important;
|
| 172 |
}
|
| 173 |
|
| 174 |
-
/*
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
padding: 20px !important;
|
| 179 |
-
margin: 20px auto !important;
|
| 180 |
-
max-width: 800px !important;
|
| 181 |
-
border: 1px solid #334155 !important;
|
| 182 |
text-align: center !important;
|
|
|
|
|
|
|
| 183 |
}
|
| 184 |
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
margin:
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
.header p {
|
| 195 |
-
color: #94a3b8 !important;
|
| 196 |
-
margin: 4px 0 !important;
|
| 197 |
-
font-size: 0.95rem !important;
|
| 198 |
-
}
|
| 199 |
-
|
| 200 |
-
/* Clean chat interface */
|
| 201 |
-
.chatbot, .chat-interface {
|
| 202 |
-
background: #1e293b !important;
|
| 203 |
-
border: 1px solid #334155 !important;
|
| 204 |
-
border-radius: 12px !important;
|
| 205 |
-
max-width: 800px !important;
|
| 206 |
-
margin: 0 auto !important;
|
| 207 |
-
padding: 0 !important;
|
| 208 |
}
|
| 209 |
|
| 210 |
-
/*
|
| 211 |
.message {
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
line-height: 1.5 !important;
|
| 219 |
-
max-width: none !important;
|
| 220 |
}
|
| 221 |
|
| 222 |
-
/* User
|
| 223 |
.message.user {
|
| 224 |
-
background: #
|
| 225 |
color: white !important;
|
| 226 |
-
margin-left:
|
| 227 |
-
margin-right:
|
| 228 |
}
|
| 229 |
|
| 230 |
-
/* Bot
|
| 231 |
.message.bot {
|
| 232 |
-
background: #
|
| 233 |
-
color: #
|
| 234 |
-
margin-right:
|
| 235 |
-
margin-left:
|
| 236 |
-
}
|
| 237 |
-
|
| 238 |
-
/* Clean input area */
|
| 239 |
-
.input-container {
|
| 240 |
-
background: #1e293b !important;
|
| 241 |
-
border-top: 1px solid #334155 !important;
|
| 242 |
-
padding: 12px !important;
|
| 243 |
}
|
| 244 |
|
|
|
|
| 245 |
textarea {
|
| 246 |
-
background: #
|
| 247 |
-
border: 1px solid #
|
| 248 |
-
color: #
|
| 249 |
-
border-radius:
|
| 250 |
-
padding:
|
| 251 |
-
font-size:
|
| 252 |
-
resize: none !important;
|
| 253 |
-
}
|
| 254 |
-
|
| 255 |
-
textarea:focus {
|
| 256 |
-
border-color: #3b82f6 !important;
|
| 257 |
-
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1) !important;
|
| 258 |
-
outline: none !important;
|
| 259 |
}
|
| 260 |
|
| 261 |
textarea::placeholder {
|
| 262 |
-
color: #
|
| 263 |
}
|
| 264 |
|
| 265 |
-
/*
|
| 266 |
button {
|
| 267 |
-
background: #
|
| 268 |
border: none !important;
|
| 269 |
color: white !important;
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
font-size: 0.9rem !important;
|
| 274 |
-
transition: background 0.2s ease !important;
|
| 275 |
}
|
| 276 |
|
| 277 |
button:hover {
|
| 278 |
-
background: #
|
| 279 |
}
|
| 280 |
|
| 281 |
-
/*
|
| 282 |
-
.retry-btn, .undo-btn, .clear-btn {
|
| 283 |
-
display: none !important;
|
| 284 |
-
}
|
| 285 |
-
|
| 286 |
-
/* Clean examples */
|
| 287 |
.examples {
|
| 288 |
-
display:
|
| 289 |
-
|
| 290 |
-
gap:
|
| 291 |
-
padding:
|
| 292 |
-
margin: 0 !important;
|
| 293 |
}
|
| 294 |
|
| 295 |
.example {
|
| 296 |
-
background: #
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
font-size: 0.85rem !important;
|
| 302 |
cursor: pointer !important;
|
| 303 |
-
|
| 304 |
}
|
| 305 |
|
| 306 |
.example:hover {
|
| 307 |
-
background: #
|
| 308 |
-
border-color: #3b82f6 !important;
|
| 309 |
-
}
|
| 310 |
-
|
| 311 |
-
/* Clean footer */
|
| 312 |
-
.footer {
|
| 313 |
-
background: #1e293b !important;
|
| 314 |
-
border: 1px solid #334155 !important;
|
| 315 |
-
border-radius: 12px !important;
|
| 316 |
-
padding: 20px !important;
|
| 317 |
-
margin: 20px auto !important;
|
| 318 |
-
max-width: 800px !important;
|
| 319 |
-
text-align: center !important;
|
| 320 |
-
}
|
| 321 |
-
|
| 322 |
-
.footer h3 {
|
| 323 |
-
color: #3b82f6 !important;
|
| 324 |
-
font-size: 1.2rem !important;
|
| 325 |
-
font-weight: 600 !important;
|
| 326 |
-
margin: 0 0 12px 0 !important;
|
| 327 |
}
|
| 328 |
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
gap: 24px !important;
|
| 333 |
-
margin: 16px 0 !important;
|
| 334 |
-
flex-wrap: wrap !important;
|
| 335 |
}
|
| 336 |
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
border: 1px solid #475569 !important;
|
| 340 |
-
padding: 12px 16px !important;
|
| 341 |
-
border-radius: 6px !important;
|
| 342 |
-
min-width: 140px !important;
|
| 343 |
text-align: center !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
}
|
| 345 |
|
| 346 |
-
.
|
| 347 |
-
color: #
|
| 348 |
-
font-size:
|
| 349 |
-
|
| 350 |
-
margin: 0 0 4px 0 !important;
|
| 351 |
-
}
|
| 352 |
-
|
| 353 |
-
.office-item p {
|
| 354 |
-
color: #94a3b8 !important;
|
| 355 |
-
font-size: 0.8rem !important;
|
| 356 |
-
margin: 2px 0 !important;
|
| 357 |
}
|
| 358 |
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
|
|
|
| 362 |
}
|
| 363 |
|
| 364 |
-
/*
|
| 365 |
-
@media (max-width:
|
| 366 |
-
.
|
| 367 |
-
|
| 368 |
-
}
|
| 369 |
-
|
| 370 |
-
.message.bot {
|
| 371 |
-
margin-right: 15% !important;
|
| 372 |
}
|
| 373 |
|
| 374 |
-
.
|
| 375 |
-
|
|
|
|
| 376 |
}
|
| 377 |
-
|
| 378 |
-
.office-grid {
|
| 379 |
-
flex-direction: column !important;
|
| 380 |
-
align-items: center !important;
|
| 381 |
-
}
|
| 382 |
-
}
|
| 383 |
-
|
| 384 |
-
/* Hide gradio branding for cleaner look */
|
| 385 |
-
.footer-links {
|
| 386 |
-
display: none !important;
|
| 387 |
-
}
|
| 388 |
-
|
| 389 |
-
/* Smooth scrolling */
|
| 390 |
-
html {
|
| 391 |
-
scroll-behavior: smooth;
|
| 392 |
-
}
|
| 393 |
-
|
| 394 |
-
/* Clean scrollbar */
|
| 395 |
-
::-webkit-scrollbar {
|
| 396 |
-
width: 6px;
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
-
::-webkit-scrollbar-track {
|
| 400 |
-
background: #1e293b;
|
| 401 |
}
|
| 402 |
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
}
|
| 407 |
|
| 408 |
-
|
| 409 |
-
|
| 410 |
}
|
| 411 |
"""
|
| 412 |
|
| 413 |
-
# Create
|
| 414 |
-
|
|
|
|
| 415 |
title="4AT Professional Assistant",
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
gr.ChatInterface(
|
| 431 |
-
fn=chat_function,
|
| 432 |
-
title="",
|
| 433 |
-
description="",
|
| 434 |
-
examples=[
|
| 435 |
-
"What is 4AT Consulting?",
|
| 436 |
-
"Who founded 4AT?",
|
| 437 |
-
"What services do you provide?",
|
| 438 |
-
"Who are 4AT's clients?",
|
| 439 |
-
"What projects has 4AT done?",
|
| 440 |
-
"How can I contact 4AT?",
|
| 441 |
-
"Tell me about your team",
|
| 442 |
-
"What makes 4AT different?"
|
| 443 |
-
]
|
| 444 |
-
)
|
| 445 |
-
|
| 446 |
-
# Clean footer
|
| 447 |
gr.HTML("""
|
| 448 |
<div class="footer">
|
| 449 |
-
<h3>4AT Consulting
|
| 450 |
-
<p
|
| 451 |
-
|
| 452 |
-
<
|
| 453 |
-
<div class="office-item">
|
| 454 |
-
<h4>🇺🇸 USA</h4>
|
| 455 |
-
<p>Princeton, NJ</p>
|
| 456 |
-
<p>+1 703 665 4255</p>
|
| 457 |
-
</div>
|
| 458 |
-
<div class="office-item">
|
| 459 |
-
<h4>🇮🇳 India</h4>
|
| 460 |
-
<p>Hyderabad, TS</p>
|
| 461 |
-
<p>+91 9010433456</p>
|
| 462 |
-
</div>
|
| 463 |
-
<div class="office-item">
|
| 464 |
-
<h4>🇦🇺 Australia</h4>
|
| 465 |
-
<p>Sydney, NSW</p>
|
| 466 |
-
</div>
|
| 467 |
-
</div>
|
| 468 |
-
|
| 469 |
-
<p style="color: #64748b; font-size: 0.85rem; margin-top: 16px;">
|
| 470 |
-
📧 info@consult-4at.com | 🌐 24/7 Global Service
|
| 471 |
-
</p>
|
| 472 |
</div>
|
| 473 |
""")
|
| 474 |
|
| 475 |
if __name__ == "__main__":
|
| 476 |
-
demo.launch(
|
|
|
|
| 3 |
import os
|
| 4 |
from typing import List, Dict
|
| 5 |
|
| 6 |
+
class Simple4ATChatbot:
|
| 7 |
def __init__(self):
|
|
|
|
| 8 |
self.setup_api()
|
| 9 |
self.knowledge_base = self.load_knowledge()
|
|
|
|
| 10 |
|
| 11 |
def setup_api(self):
|
|
|
|
| 12 |
self.api_working = False
|
| 13 |
try:
|
| 14 |
api_key = os.environ.get("GOOGLE_API_KEY")
|
|
|
|
| 21 |
pass
|
| 22 |
|
| 23 |
def load_knowledge(self) -> Dict[str, str]:
|
|
|
|
| 24 |
return {
|
| 25 |
+
"about": "4AT is a leading consulting firm specializing in Accounting, Audit, Assurance, Advisory, and Technology services. We serve enterprises with Big 4 expertise and customized solutions.",
|
| 26 |
|
| 27 |
+
"services": "4AT provides Accounting Process Outsourcing, SOX Compliance, Technical Accounting, Audit Outsourcing, Tax Advisory, IPO Readiness, Cloud Services, Cyber Security, Data Analytics, RPA, and professional training through 4AT Academy.",
|
| 28 |
|
| 29 |
+
"leadership": "4AT was founded by Managing Partners Ravi Krovvidi (20+ years Finance & Accounting) and Aruna Sharma (15+ years public accounting, Big 4 background). Key leaders include Chetana RG Kaasam, Srigouri Mantrala, and D Satish Kumar.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
"clients": "4AT serves major clients including Deloitte, BDO, SENSIBA SAN FILIPPO, BPM, AEMETIS, and TeamLease. We've completed 45+ successful projects across 3 countries with 100% client satisfaction.",
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
"contact": "Contact 4AT: USA - Princeton, NJ (+1 703 665 4255) | India - Hyderabad, TS (+91 9010433456) | Australia - Sydney, NSW | Email: info@consult-4at.com | 24/7 global service.",
|
|
|
|
| 34 |
|
| 35 |
+
"experience": "4AT has Big 4 heritage with 100+ years combined expertise, global operations across USA, India, Australia, and a proven track record of 45+ projects with zero missed deadlines."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
|
| 38 |
def detect_intent(self, query: str) -> str:
|
| 39 |
+
q = query.lower()
|
|
|
|
| 40 |
|
| 41 |
+
if any(word in q for word in ["client", "customer", "work with", "project", "deloitte", "bdo"]):
|
| 42 |
return "clients"
|
| 43 |
+
elif any(word in q for word in ["founder", "partner", "team", "leadership", "ravi", "aruna"]):
|
| 44 |
return "leadership"
|
| 45 |
+
elif any(word in q for word in ["service", "offer", "provide", "do", "help", "sox", "audit", "accounting"]):
|
| 46 |
return "services"
|
| 47 |
+
elif any(word in q for word in ["contact", "phone", "email", "address", "location", "office"]):
|
| 48 |
return "contact"
|
| 49 |
elif any(word in q for word in ["when", "start", "establish", "history", "experience", "background"]):
|
| 50 |
return "experience"
|
|
|
|
| 52 |
return "about"
|
| 53 |
|
| 54 |
def generate_response(self, query: str, history: List = None) -> str:
|
|
|
|
| 55 |
intent = self.detect_intent(query)
|
| 56 |
context = self.knowledge_base[intent]
|
| 57 |
|
| 58 |
if self.api_working:
|
| 59 |
try:
|
| 60 |
+
prompt = f"You are 4AT's assistant. Answer briefly and professionally (1-2 sentences).\n\nUser: {query}\nInfo: {context}\n\nResponse:"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
response = self.model.generate_content(prompt)
|
| 62 |
return response.text
|
| 63 |
except:
|
| 64 |
pass
|
| 65 |
|
| 66 |
+
return context
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
+
chatbot = Simple4ATChatbot()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
def chat_function(message, history):
|
|
|
|
| 71 |
try:
|
| 72 |
return chatbot.generate_response(message, history)
|
| 73 |
except:
|
| 74 |
+
return "Contact us: +1 703 665 4255 | info@consult-4at.com"
|
| 75 |
|
| 76 |
+
# ULTRA SIMPLE CSS - NO CLUTTER
|
| 77 |
+
simple_css = """
|
| 78 |
+
/* Ultra Simple Design */
|
| 79 |
.gradio-container {
|
| 80 |
+
background: #1a1a1a !important;
|
| 81 |
+
color: #ffffff !important;
|
| 82 |
+
font-family: system-ui, sans-serif !important;
|
| 83 |
+
padding: 10px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
+
/* Simple header */
|
| 87 |
+
h1 {
|
| 88 |
+
color: #4a90e2 !important;
|
| 89 |
+
font-size: 1.5rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
text-align: center !important;
|
| 91 |
+
margin: 10px 0 !important;
|
| 92 |
+
font-weight: 600 !important;
|
| 93 |
}
|
| 94 |
|
| 95 |
+
/* Simple chat container */
|
| 96 |
+
.chatbot {
|
| 97 |
+
background: #2a2a2a !important;
|
| 98 |
+
border: 1px solid #404040 !important;
|
| 99 |
+
border-radius: 8px !important;
|
| 100 |
+
max-width: 700px !important;
|
| 101 |
+
margin: 10px auto !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
}
|
| 103 |
|
| 104 |
+
/* SIMPLE MESSAGES - NO BULK */
|
| 105 |
.message {
|
| 106 |
+
padding: 8px 12px !important;
|
| 107 |
+
margin: 4px 8px !important;
|
| 108 |
+
border-radius: 6px !important;
|
| 109 |
+
font-size: 14px !important;
|
| 110 |
+
line-height: 1.4 !important;
|
| 111 |
+
max-width: 80% !important;
|
|
|
|
|
|
|
| 112 |
}
|
| 113 |
|
| 114 |
+
/* User message - simple blue */
|
| 115 |
.message.user {
|
| 116 |
+
background: #4a90e2 !important;
|
| 117 |
color: white !important;
|
| 118 |
+
margin-left: auto !important;
|
| 119 |
+
margin-right: 8px !important;
|
| 120 |
}
|
| 121 |
|
| 122 |
+
/* Bot message - simple gray */
|
| 123 |
.message.bot {
|
| 124 |
+
background: #404040 !important;
|
| 125 |
+
color: #ffffff !important;
|
| 126 |
+
margin-right: auto !important;
|
| 127 |
+
margin-left: 8px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
+
/* Simple input */
|
| 131 |
textarea {
|
| 132 |
+
background: #404040 !important;
|
| 133 |
+
border: 1px solid #606060 !important;
|
| 134 |
+
color: #ffffff !important;
|
| 135 |
+
border-radius: 6px !important;
|
| 136 |
+
padding: 8px !important;
|
| 137 |
+
font-size: 14px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
}
|
| 139 |
|
| 140 |
textarea::placeholder {
|
| 141 |
+
color: #888888 !important;
|
| 142 |
}
|
| 143 |
|
| 144 |
+
/* Simple button */
|
| 145 |
button {
|
| 146 |
+
background: #4a90e2 !important;
|
| 147 |
border: none !important;
|
| 148 |
color: white !important;
|
| 149 |
+
border-radius: 4px !important;
|
| 150 |
+
padding: 6px 12px !important;
|
| 151 |
+
font-size: 14px !important;
|
|
|
|
|
|
|
| 152 |
}
|
| 153 |
|
| 154 |
button:hover {
|
| 155 |
+
background: #357abd !important;
|
| 156 |
}
|
| 157 |
|
| 158 |
+
/* Simple examples */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
.examples {
|
| 160 |
+
display: flex !important;
|
| 161 |
+
flex-wrap: wrap !important;
|
| 162 |
+
gap: 6px !important;
|
| 163 |
+
padding: 8px !important;
|
|
|
|
| 164 |
}
|
| 165 |
|
| 166 |
.example {
|
| 167 |
+
background: #404040 !important;
|
| 168 |
+
color: #ffffff !important;
|
| 169 |
+
padding: 6px 10px !important;
|
| 170 |
+
border-radius: 4px !important;
|
| 171 |
+
font-size: 12px !important;
|
|
|
|
| 172 |
cursor: pointer !important;
|
| 173 |
+
border: 1px solid #606060 !important;
|
| 174 |
}
|
| 175 |
|
| 176 |
.example:hover {
|
| 177 |
+
background: #4a90e2 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
}
|
| 179 |
|
| 180 |
+
/* Remove all unnecessary elements */
|
| 181 |
+
.retry-btn, .undo-btn, .clear-btn, .share-btn {
|
| 182 |
+
display: none !important;
|
|
|
|
|
|
|
|
|
|
| 183 |
}
|
| 184 |
|
| 185 |
+
/* Simple footer */
|
| 186 |
+
.footer {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
text-align: center !important;
|
| 188 |
+
padding: 15px !important;
|
| 189 |
+
margin: 10px auto !important;
|
| 190 |
+
max-width: 700px !important;
|
| 191 |
+
background: #2a2a2a !important;
|
| 192 |
+
border-radius: 8px !important;
|
| 193 |
+
border: 1px solid #404040 !important;
|
| 194 |
}
|
| 195 |
|
| 196 |
+
.footer h3 {
|
| 197 |
+
color: #4a90e2 !important;
|
| 198 |
+
font-size: 1.1rem !important;
|
| 199 |
+
margin: 0 0 8px 0 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
}
|
| 201 |
|
| 202 |
+
.footer p {
|
| 203 |
+
color: #cccccc !important;
|
| 204 |
+
font-size: 13px !important;
|
| 205 |
+
margin: 4px 0 !important;
|
| 206 |
}
|
| 207 |
|
| 208 |
+
/* Mobile responsive */
|
| 209 |
+
@media (max-width: 600px) {
|
| 210 |
+
.gradio-container {
|
| 211 |
+
padding: 5px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
}
|
| 213 |
|
| 214 |
+
.message {
|
| 215 |
+
max-width: 90% !important;
|
| 216 |
+
font-size: 13px !important;
|
| 217 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
}
|
| 219 |
|
| 220 |
+
/* Hide extra gradio elements */
|
| 221 |
+
.gradio-container .wrap {
|
| 222 |
+
gap: 8px !important;
|
| 223 |
}
|
| 224 |
|
| 225 |
+
.gradio-container > div > div {
|
| 226 |
+
gap: 8px !important;
|
| 227 |
}
|
| 228 |
"""
|
| 229 |
|
| 230 |
+
# Create ultra simple interface
|
| 231 |
+
demo = gr.ChatInterface(
|
| 232 |
+
fn=chat_function,
|
| 233 |
title="4AT Professional Assistant",
|
| 234 |
+
description="Expert AI for Accounting, Audit, Advisory & Technology",
|
| 235 |
+
examples=[
|
| 236 |
+
"What is 4AT?",
|
| 237 |
+
"Who founded 4AT?",
|
| 238 |
+
"What services do you offer?",
|
| 239 |
+
"Who are your clients?",
|
| 240 |
+
"How to contact 4AT?",
|
| 241 |
+
"Tell me about your team"
|
| 242 |
+
],
|
| 243 |
+
css=simple_css
|
| 244 |
+
)
|
| 245 |
+
|
| 246 |
+
# Add simple footer
|
| 247 |
+
with demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
gr.HTML("""
|
| 249 |
<div class="footer">
|
| 250 |
+
<h3>4AT Consulting</h3>
|
| 251 |
+
<p>Accounting • Audit • Advisory • Technology</p>
|
| 252 |
+
<p>📞 +1 703 665 4255 | 📧 info@consult-4at.com</p>
|
| 253 |
+
<p>🌍 USA • India • Australia</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
</div>
|
| 255 |
""")
|
| 256 |
|
| 257 |
if __name__ == "__main__":
|
| 258 |
+
demo.launch()
|