Update scripts/main.py
Browse files- scripts/main.py +236 -306
scripts/main.py
CHANGED
|
@@ -1,15 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import google.generativeai as genai
|
| 3 |
import os
|
| 4 |
-
import
|
| 5 |
-
from typing import List, Dict, Any
|
| 6 |
|
| 7 |
-
class
|
| 8 |
def __init__(self):
|
| 9 |
-
"""
|
| 10 |
self.setup_api()
|
| 11 |
self.knowledge_base = self.load_knowledge()
|
| 12 |
-
print(f"🤖 4AT Assistant ready
|
| 13 |
|
| 14 |
def setup_api(self):
|
| 15 |
"""Setup Google AI with fallback"""
|
|
@@ -19,526 +18,457 @@ class Smart4ATChatbot:
|
|
| 19 |
if api_key:
|
| 20 |
genai.configure(api_key=api_key)
|
| 21 |
self.model = genai.GenerativeModel('gemini-1.5-flash')
|
| 22 |
-
# Quick test
|
| 23 |
self.model.generate_content("test")
|
| 24 |
self.api_working = True
|
| 25 |
except:
|
| 26 |
-
|
| 27 |
|
| 28 |
def load_knowledge(self) -> Dict[str, str]:
|
| 29 |
-
"""
|
| 30 |
return {
|
| 31 |
-
"about": """4AT is a leading consulting firm specializing in
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
**
|
| 36 |
-
|
| 37 |
-
"services": """**4AT Core Services:**
|
| 38 |
-
|
| 39 |
-
**🏢 Accounting & Audit**
|
| 40 |
• Accounting Process Outsourcing (APO)
|
| 41 |
• SOX Compliance & Internal Controls
|
| 42 |
-
• Technical Accounting
|
| 43 |
• Audit Outsourcing & Readiness
|
| 44 |
• Tax Advisory & IPO Readiness
|
| 45 |
|
| 46 |
-
|
| 47 |
• Cloud Services (AWS, Azure, GCP)
|
| 48 |
• Cyber Security & Data Analytics
|
| 49 |
• Robotic Process Automation (RPA)
|
| 50 |
|
| 51 |
-
|
| 52 |
• 4AT Academy (CPA, CMA, IFRS, SOX training)""",
|
| 53 |
|
| 54 |
-
"leadership": """**4AT
|
| 55 |
|
| 56 |
**Managing Partners:**
|
| 57 |
-
• **Ravi Krovvidi** - 20+ years Finance & Accounting, global experience
|
| 58 |
• **Aruna Sharma** - 15+ years public accounting, Chartered Accountant, Big 4 background
|
| 59 |
|
| 60 |
**Key Leaders:**
|
| 61 |
-
• **Chetana RG Kaasam**
|
| 62 |
-
• **Ron Ramakrishnan** - Operations & HR, SLA-driven delivery
|
| 63 |
• **Srigouri Mantrala** - 24+ years, Big Four SOX expert
|
| 64 |
• **D Satish Kumar** - 15+ years Fortune 500 experience""",
|
| 65 |
|
| 66 |
-
"clients": """**4AT
|
| 67 |
|
| 68 |
-
**Major Clients:** Deloitte, BDO, SENSIBA SAN FILIPPO, BPM, AEMETIS, TeamLease, Bharat Group
|
| 69 |
|
| 70 |
-
**
|
| 71 |
-
•
|
| 72 |
-
•
|
| 73 |
-
•
|
| 74 |
-
• **Streamlined accounting operations** for multiple Fortune 500 companies
|
| 75 |
|
| 76 |
-
|
| 77 |
|
| 78 |
"contact": """**Contact 4AT:**
|
| 79 |
|
| 80 |
-
**🇺🇸 USA:** Princeton, NJ |
|
| 81 |
-
**🇮🇳 India:** Hyderabad, TS |
|
| 82 |
**🇦🇺 Australia:** Sydney, NSW
|
| 83 |
**📧 Email:** info@consult-4at.com
|
| 84 |
|
| 85 |
-
|
| 86 |
|
| 87 |
"experience": """**4AT Background:**
|
| 88 |
|
| 89 |
-
•
|
| 90 |
-
•
|
| 91 |
-
•
|
| 92 |
-
•
|
| 93 |
-
• **Proven Track Record** - Zero missed deadlines, 100% client satisfaction
|
| 94 |
-
|
| 95 |
-
**Established** with Big 4 expertise to serve global enterprises."""
|
| 96 |
}
|
| 97 |
|
| 98 |
def detect_intent(self, query: str) -> str:
|
| 99 |
-
"""
|
| 100 |
q = query.lower().strip()
|
| 101 |
|
| 102 |
-
|
| 103 |
-
if any(word in q for word in [
|
| 104 |
-
"client", "customer", "portfolio", "work with", "worked with",
|
| 105 |
-
"project", "success", "case study", "testimonial", "deloitte",
|
| 106 |
-
"bdo", "companies we serve", "who do you work", "engagements"
|
| 107 |
-
]):
|
| 108 |
return "clients"
|
| 109 |
-
|
| 110 |
-
# LEADERSHIP INTENT
|
| 111 |
-
elif any(word in q for word in [
|
| 112 |
-
"founder", "founded", "partner", "management", "team", "leadership",
|
| 113 |
-
"ceo", "owner", "ravi", "aruna", "who runs", "heads"
|
| 114 |
-
]):
|
| 115 |
return "leadership"
|
| 116 |
-
|
| 117 |
-
# SERVICES INTENT
|
| 118 |
-
elif any(word in q for word in [
|
| 119 |
-
"service", "offer", "provide", "do", "capabilities", "help",
|
| 120 |
-
"sox", "audit", "accounting", "tax", "consulting", "what do you do"
|
| 121 |
-
]):
|
| 122 |
return "services"
|
| 123 |
-
|
| 124 |
-
# CONTACT INTENT
|
| 125 |
-
elif any(word in q for word in [
|
| 126 |
-
"contact", "phone", "email", "address", "location", "office",
|
| 127 |
-
"reach", "call", "where", "how to contact"
|
| 128 |
-
]):
|
| 129 |
return "contact"
|
| 130 |
-
|
| 131 |
-
# EXPERIENCE/HISTORY INTENT
|
| 132 |
-
elif any(word in q for word in [
|
| 133 |
-
"when", "start", "establish", "history", "experience", "background",
|
| 134 |
-
"how long", "since when", "track record"
|
| 135 |
-
]):
|
| 136 |
return "experience"
|
| 137 |
-
|
| 138 |
-
# DEFAULT TO ABOUT
|
| 139 |
else:
|
| 140 |
return "about"
|
| 141 |
|
| 142 |
def generate_response(self, query: str, history: List = None) -> str:
|
| 143 |
-
"""Generate
|
| 144 |
intent = self.detect_intent(query)
|
| 145 |
context = self.knowledge_base[intent]
|
| 146 |
|
| 147 |
-
# Try AI enhancement if available
|
| 148 |
if self.api_working:
|
| 149 |
try:
|
| 150 |
-
prompt = f"""You are 4AT Consulting's
|
| 151 |
-
|
| 152 |
-
User asked: "{query}"
|
| 153 |
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
Instructions:
|
| 157 |
-
1. Answer concisely and professionally (2-4 sentences max)
|
| 158 |
-
2. Be conversational but authoritative
|
| 159 |
-
3. Include specific details when relevant
|
| 160 |
-
4. End with a helpful next step if appropriate
|
| 161 |
|
| 162 |
Response:"""
|
| 163 |
-
|
| 164 |
response = self.model.generate_content(prompt)
|
| 165 |
return response.text
|
| 166 |
except:
|
| 167 |
pass
|
| 168 |
|
| 169 |
-
#
|
| 170 |
-
return self.create_professional_response(intent, context, query)
|
| 171 |
-
|
| 172 |
-
def create_professional_response(self, intent: str, context: str, query: str) -> str:
|
| 173 |
-
"""Create concise professional responses"""
|
| 174 |
-
|
| 175 |
if intent == "clients":
|
| 176 |
-
return f"""
|
| 177 |
-
|
| 178 |
-
{context}
|
| 179 |
-
|
| 180 |
-
*Would you like to know more about our services or discuss how we can help your business?*"""
|
| 181 |
|
|
|
|
| 182 |
elif intent == "leadership":
|
| 183 |
-
return f"""
|
| 184 |
-
|
| 185 |
-
{context}
|
| 186 |
-
|
| 187 |
-
*Our experienced team brings Big 4 expertise to deliver world-class consulting services.*"""
|
| 188 |
|
|
|
|
| 189 |
elif intent == "services":
|
| 190 |
return f"""{context}
|
| 191 |
|
| 192 |
-
|
| 193 |
-
|
| 194 |
elif intent == "contact":
|
| 195 |
return f"""{context}
|
| 196 |
|
| 197 |
-
|
| 198 |
-
|
| 199 |
elif intent == "experience":
|
| 200 |
return f"""{context}
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
else:
|
| 205 |
return f"""{context}
|
| 206 |
|
| 207 |
-
|
| 208 |
|
| 209 |
# Initialize chatbot
|
| 210 |
-
chatbot =
|
| 211 |
|
| 212 |
def chat_function(message, history):
|
| 213 |
-
"""
|
| 214 |
try:
|
| 215 |
return chatbot.generate_response(message, history)
|
| 216 |
-
except
|
| 217 |
-
return """
|
| 218 |
-
📞 +1 703 665 4255 | 📧 info@consult-4at.com
|
| 219 |
-
|
| 220 |
-
*Our experts are ready to help with any questions about 4AT's services.*"""
|
| 221 |
-
|
| 222 |
-
# PROFESSIONAL DARK THEME CSS
|
| 223 |
-
dark_professional_css = """
|
| 224 |
-
/* 4AT Professional Dark Theme */
|
| 225 |
-
:root {
|
| 226 |
-
--primary-bg: #0a0e1a;
|
| 227 |
-
--secondary-bg: #1a1f2e;
|
| 228 |
-
--accent-bg: #242938;
|
| 229 |
-
--primary-text: #e2e4e9;
|
| 230 |
-
--secondary-text: #a0a4b0;
|
| 231 |
-
--accent-color: #3b82f6;
|
| 232 |
-
--success-color: #10b981;
|
| 233 |
-
--border-color: #2d3748;
|
| 234 |
-
}
|
| 235 |
|
|
|
|
|
|
|
|
|
|
| 236 |
.gradio-container {
|
| 237 |
-
background:
|
| 238 |
-
color:
|
| 239 |
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
| 240 |
-
min-height: 100vh;
|
| 241 |
}
|
| 242 |
|
| 243 |
-
/* Remove
|
| 244 |
.gradio-container > div {
|
| 245 |
background: transparent !important;
|
|
|
|
|
|
|
| 246 |
}
|
| 247 |
|
| 248 |
-
/*
|
| 249 |
-
.
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
padding: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
}
|
| 254 |
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
background: linear-gradient(135deg, #3b82f6, #06b6d4, #10b981) !important;
|
| 258 |
-webkit-background-clip: text !important;
|
| 259 |
-webkit-text-fill-color: transparent !important;
|
|
|
|
| 260 |
font-weight: 700 !important;
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
|
|
|
|
|
|
|
|
|
| 265 |
}
|
| 266 |
|
| 267 |
-
/*
|
| 268 |
-
.chatbot {
|
| 269 |
-
background:
|
| 270 |
-
border: 1px solid
|
| 271 |
-
border-radius:
|
| 272 |
-
|
| 273 |
-
|
|
|
|
| 274 |
}
|
| 275 |
|
| 276 |
-
/*
|
| 277 |
.message {
|
| 278 |
background: transparent !important;
|
| 279 |
border: none !important;
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
line-height: 1.
|
|
|
|
| 285 |
}
|
| 286 |
|
| 287 |
-
/* User messages */
|
| 288 |
.message.user {
|
| 289 |
-
background:
|
| 290 |
color: white !important;
|
| 291 |
-
margin-left:
|
| 292 |
-
|
| 293 |
}
|
| 294 |
|
| 295 |
-
/* Bot messages */
|
| 296 |
.message.bot {
|
| 297 |
-
background:
|
| 298 |
-
|
| 299 |
-
margin-right:
|
| 300 |
-
|
| 301 |
}
|
| 302 |
|
| 303 |
-
/*
|
| 304 |
-
.input-container
|
| 305 |
-
background:
|
| 306 |
-
border: 1px solid
|
| 307 |
-
|
| 308 |
-
border-radius: 12px !important;
|
| 309 |
}
|
| 310 |
|
| 311 |
-
textarea
|
| 312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
}
|
| 314 |
|
| 315 |
textarea:focus {
|
| 316 |
-
border-color:
|
| 317 |
-
box-shadow: 0 0 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
}
|
| 319 |
|
| 320 |
-
/*
|
| 321 |
button {
|
| 322 |
-
background:
|
| 323 |
border: none !important;
|
| 324 |
color: white !important;
|
| 325 |
-
font-weight:
|
| 326 |
-
border-radius:
|
| 327 |
-
padding:
|
| 328 |
-
|
| 329 |
-
|
| 330 |
}
|
| 331 |
|
| 332 |
button:hover {
|
| 333 |
-
|
| 334 |
-
box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4) !important;
|
| 335 |
-
background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
|
| 336 |
}
|
| 337 |
|
| 338 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
.examples {
|
| 340 |
display: grid !important;
|
| 341 |
-
grid-template-columns: repeat(auto-fit, minmax(
|
| 342 |
-
gap:
|
| 343 |
-
|
|
|
|
| 344 |
}
|
| 345 |
|
| 346 |
.example {
|
| 347 |
-
background:
|
| 348 |
-
border: 1px solid
|
| 349 |
-
color:
|
| 350 |
-
padding: 14px
|
| 351 |
-
border-radius:
|
|
|
|
| 352 |
cursor: pointer !important;
|
| 353 |
-
transition: all 0.
|
| 354 |
-
font-size: 0.95rem !important;
|
| 355 |
}
|
| 356 |
|
| 357 |
.example:hover {
|
| 358 |
-
background:
|
| 359 |
-
border-color:
|
| 360 |
-
transform: translateY(-1px) !important;
|
| 361 |
-
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
|
| 362 |
-
}
|
| 363 |
-
|
| 364 |
-
/* Scrollbar */
|
| 365 |
-
::-webkit-scrollbar {
|
| 366 |
-
width: 8px;
|
| 367 |
-
}
|
| 368 |
-
|
| 369 |
-
::-webkit-scrollbar-track {
|
| 370 |
-
background: var(--secondary-bg);
|
| 371 |
-
}
|
| 372 |
-
|
| 373 |
-
::-webkit-scrollbar-thumb {
|
| 374 |
-
background: var(--accent-color);
|
| 375 |
-
border-radius: 4px;
|
| 376 |
-
}
|
| 377 |
-
|
| 378 |
-
::-webkit-scrollbar-thumb:hover {
|
| 379 |
-
background: #2563eb;
|
| 380 |
}
|
| 381 |
|
| 382 |
-
/*
|
| 383 |
.footer {
|
| 384 |
-
background:
|
| 385 |
-
border: 1px solid
|
| 386 |
-
border-radius:
|
| 387 |
-
padding:
|
| 388 |
-
margin
|
|
|
|
| 389 |
text-align: center !important;
|
| 390 |
}
|
| 391 |
|
| 392 |
.footer h3 {
|
| 393 |
-
color:
|
|
|
|
| 394 |
font-weight: 600 !important;
|
| 395 |
-
margin
|
| 396 |
}
|
| 397 |
|
| 398 |
.office-grid {
|
| 399 |
-
display:
|
| 400 |
-
|
| 401 |
-
gap:
|
| 402 |
-
margin:
|
|
|
|
| 403 |
}
|
| 404 |
|
| 405 |
.office-item {
|
| 406 |
-
background:
|
| 407 |
-
border: 1px solid
|
| 408 |
-
padding:
|
| 409 |
-
border-radius:
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
.office-item:hover {
|
| 414 |
-
border-color: var(--accent-color) !important;
|
| 415 |
-
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
|
| 416 |
}
|
| 417 |
|
| 418 |
.office-item h4 {
|
| 419 |
-
color:
|
|
|
|
| 420 |
font-weight: 600 !important;
|
| 421 |
-
margin
|
| 422 |
}
|
| 423 |
|
| 424 |
.office-item p {
|
| 425 |
-
color:
|
| 426 |
-
font-size: 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
}
|
| 428 |
|
| 429 |
/* Responsive */
|
| 430 |
@media (max-width: 768px) {
|
| 431 |
-
h1 {
|
| 432 |
-
font-size: 2rem !important;
|
| 433 |
-
}
|
| 434 |
-
|
| 435 |
.message.user {
|
| 436 |
-
margin-left:
|
| 437 |
}
|
| 438 |
|
| 439 |
.message.bot {
|
| 440 |
-
margin-right:
|
| 441 |
}
|
| 442 |
|
| 443 |
.examples {
|
| 444 |
grid-template-columns: 1fr !important;
|
| 445 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
}
|
| 447 |
|
| 448 |
-
/*
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
to { opacity: 1; transform: translateY(0); }
|
| 452 |
}
|
| 453 |
|
| 454 |
-
|
| 455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
}
|
| 457 |
"""
|
| 458 |
|
| 459 |
-
# Create
|
| 460 |
with gr.Blocks(
|
| 461 |
-
title="4AT
|
| 462 |
-
css=
|
| 463 |
-
theme=gr.themes.Base(
|
| 464 |
-
primary_hue="blue",
|
| 465 |
-
secondary_hue="slate",
|
| 466 |
-
neutral_hue="slate"
|
| 467 |
-
)
|
| 468 |
) as demo:
|
| 469 |
|
| 470 |
-
#
|
| 471 |
gr.HTML("""
|
| 472 |
-
<div
|
| 473 |
-
<
|
| 474 |
-
<
|
| 475 |
-
<p style="
|
| 476 |
-
<strong>Expert AI Assistant for Accounting, Audit, Advisory & Technology</strong>
|
| 477 |
-
</p>
|
| 478 |
-
<p style="color: var(--secondary-text); font-size: 1rem;">
|
| 479 |
-
Ask me about our services, team, clients, or how we can help your business
|
| 480 |
-
</p>
|
| 481 |
-
<div style="display: flex; justify-content: center; gap: 30px; margin-top: 20px; flex-wrap: wrap;">
|
| 482 |
-
<div style="color: var(--accent-color); font-weight: 600;">⚡ Instant Responses</div>
|
| 483 |
-
<div style="color: var(--success-color); font-weight: 600;">🏆 Big 4 Expertise</div>
|
| 484 |
-
<div style="color: #06b6d4; font-weight: 600;">🌍 Global Presence</div>
|
| 485 |
-
</div>
|
| 486 |
</div>
|
| 487 |
""")
|
| 488 |
|
| 489 |
-
#
|
| 490 |
-
|
| 491 |
fn=chat_function,
|
| 492 |
title="",
|
| 493 |
description="",
|
| 494 |
examples=[
|
| 495 |
"What is 4AT Consulting?",
|
| 496 |
-
"Who founded 4AT?",
|
| 497 |
"What services do you provide?",
|
| 498 |
"Who are 4AT's clients?",
|
| 499 |
"What projects has 4AT done?",
|
| 500 |
"How can I contact 4AT?",
|
| 501 |
"Tell me about your team",
|
| 502 |
-
"What
|
| 503 |
-
"What makes 4AT different?",
|
| 504 |
-
"How can 4AT help my business?"
|
| 505 |
]
|
| 506 |
)
|
| 507 |
|
| 508 |
-
#
|
| 509 |
gr.HTML("""
|
| 510 |
<div class="footer">
|
| 511 |
-
<h3
|
| 512 |
-
<p style="color:
|
| 513 |
-
<strong>Accounting • Audit • Advisory • Technology</strong>
|
| 514 |
-
</p>
|
| 515 |
|
| 516 |
<div class="office-grid">
|
| 517 |
<div class="office-item">
|
| 518 |
<h4>🇺🇸 USA</h4>
|
| 519 |
-
<p
|
| 520 |
<p>+1 703 665 4255</p>
|
| 521 |
</div>
|
| 522 |
<div class="office-item">
|
| 523 |
<h4>🇮🇳 India</h4>
|
| 524 |
-
<p
|
| 525 |
<p>+91 9010433456</p>
|
| 526 |
</div>
|
| 527 |
<div class="office-item">
|
| 528 |
<h4>🇦🇺 Australia</h4>
|
| 529 |
-
<p
|
| 530 |
-
<p>Coming Soon</p>
|
| 531 |
</div>
|
| 532 |
</div>
|
| 533 |
|
| 534 |
-
<
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
</p>
|
| 538 |
-
<p style="color: var(--secondary-text); font-size: 0.9rem;">
|
| 539 |
-
Trusted by <strong>Deloitte, BDO, SENSIBA SAN FILIPPO</strong> and leading firms worldwide
|
| 540 |
-
</p>
|
| 541 |
-
</div>
|
| 542 |
</div>
|
| 543 |
""")
|
| 544 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import google.generativeai as genai
|
| 3 |
import os
|
| 4 |
+
from typing import List, Dict
|
|
|
|
| 5 |
|
| 6 |
+
class Clean4ATChatbot:
|
| 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"""
|
|
|
|
| 18 |
if api_key:
|
| 19 |
genai.configure(api_key=api_key)
|
| 20 |
self.model = genai.GenerativeModel('gemini-1.5-flash')
|
|
|
|
| 21 |
self.model.generate_content("test")
|
| 22 |
self.api_working = True
|
| 23 |
except:
|
| 24 |
+
pass
|
| 25 |
|
| 26 |
def load_knowledge(self) -> Dict[str, str]:
|
| 27 |
+
"""Clean, concise knowledge base"""
|
| 28 |
return {
|
| 29 |
+
"about": """4AT is a leading consulting firm specializing in Accounting, Audit, Assurance, Advisory, and Technology services. We serve enterprises across multiple industries with Big 4 expertise and customized solutions.""",
|
| 30 |
|
| 31 |
+
"services": """**4AT Services:**
|
| 32 |
|
| 33 |
+
**Accounting & Audit**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
**Technology**
|
| 41 |
• Cloud Services (AWS, Azure, GCP)
|
| 42 |
• Cyber Security & Data Analytics
|
| 43 |
• Robotic Process Automation (RPA)
|
| 44 |
|
| 45 |
+
**Education**
|
| 46 |
• 4AT Academy (CPA, CMA, IFRS, SOX training)""",
|
| 47 |
|
| 48 |
+
"leadership": """**4AT Leadership:**
|
| 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 |
+
"""Smart intent detection"""
|
| 89 |
q = query.lower().strip()
|
| 90 |
|
| 91 |
+
if any(word in q for word in ["client", "customer", "portfolio", "work with", "project", "deloitte", "bdo", "success"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
return "clients"
|
| 93 |
+
elif any(word in q for word in ["founder", "partner", "team", "leadership", "ravi", "aruna", "management"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
return "leadership"
|
| 95 |
+
elif any(word in q for word in ["service", "offer", "provide", "do", "help", "sox", "audit", "accounting", "consulting"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
return "services"
|
| 97 |
+
elif any(word in q for word in ["contact", "phone", "email", "address", "location", "office", "reach"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
return "contact"
|
| 99 |
+
elif any(word in q for word in ["when", "start", "establish", "history", "experience", "background"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
return "experience"
|
|
|
|
|
|
|
| 101 |
else:
|
| 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"""You are 4AT Consulting's assistant. Answer concisely and professionally (2-3 sentences max).
|
|
|
|
|
|
|
| 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 |
+
# Clean fallback responses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
Our experienced team brings Big 4 expertise to deliver world-class services."""
|
| 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 """Contact our team: +1 703 665 4255 | info@consult-4at.com"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
+
# CLEAN & MINIMAL CSS
|
| 159 |
+
clean_css = """
|
| 160 |
+
/* Clean Professional Theme */
|
| 161 |
.gradio-container {
|
| 162 |
+
background: #0f172a !important;
|
| 163 |
+
color: #e2e8f0 !important;
|
| 164 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
|
|
|
|
| 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 |
+
/* Clean header */
|
| 175 |
+
.header {
|
| 176 |
+
background: #1e293b !important;
|
| 177 |
+
border-radius: 12px !important;
|
| 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 |
+
.header h1 {
|
| 186 |
+
background: linear-gradient(135deg, #3b82f6, #06b6d4) !important;
|
|
|
|
| 187 |
-webkit-background-clip: text !important;
|
| 188 |
-webkit-text-fill-color: transparent !important;
|
| 189 |
+
font-size: 1.8rem !important;
|
| 190 |
font-weight: 700 !important;
|
| 191 |
+
margin: 0 0 8px 0 !important;
|
| 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 |
+
/* Clean messages */
|
| 211 |
.message {
|
| 212 |
background: transparent !important;
|
| 213 |
border: none !important;
|
| 214 |
+
padding: 12px 16px !important;
|
| 215 |
+
margin: 6px 12px !important;
|
| 216 |
+
border-radius: 8px !important;
|
| 217 |
+
font-size: 0.9rem !important;
|
| 218 |
+
line-height: 1.5 !important;
|
| 219 |
+
max-width: none !important;
|
| 220 |
}
|
| 221 |
|
| 222 |
+
/* User messages - clean and minimal */
|
| 223 |
.message.user {
|
| 224 |
+
background: #3b82f6 !important;
|
| 225 |
color: white !important;
|
| 226 |
+
margin-left: 25% !important;
|
| 227 |
+
margin-right: 12px !important;
|
| 228 |
}
|
| 229 |
|
| 230 |
+
/* Bot messages - clean and minimal */
|
| 231 |
.message.bot {
|
| 232 |
+
background: #334155 !important;
|
| 233 |
+
color: #e2e8f0 !important;
|
| 234 |
+
margin-right: 25% !important;
|
| 235 |
+
margin-left: 12px !important;
|
| 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: #334155 !important;
|
| 247 |
+
border: 1px solid #475569 !important;
|
| 248 |
+
color: #e2e8f0 !important;
|
| 249 |
+
border-radius: 8px !important;
|
| 250 |
+
padding: 12px !important;
|
| 251 |
+
font-size: 0.9rem !important;
|
| 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: #94a3b8 !important;
|
| 263 |
}
|
| 264 |
|
| 265 |
+
/* Clean buttons */
|
| 266 |
button {
|
| 267 |
+
background: #3b82f6 !important;
|
| 268 |
border: none !important;
|
| 269 |
color: white !important;
|
| 270 |
+
font-weight: 500 !important;
|
| 271 |
+
border-radius: 6px !important;
|
| 272 |
+
padding: 8px 16px !important;
|
| 273 |
+
font-size: 0.9rem !important;
|
| 274 |
+
transition: background 0.2s ease !important;
|
| 275 |
}
|
| 276 |
|
| 277 |
button:hover {
|
| 278 |
+
background: #2563eb !important;
|
|
|
|
|
|
|
| 279 |
}
|
| 280 |
|
| 281 |
+
/* Hide retry/undo buttons - cleaner interface */
|
| 282 |
+
.retry-btn, .undo-btn, .clear-btn {
|
| 283 |
+
display: none !important;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
/* Clean examples */
|
| 287 |
.examples {
|
| 288 |
display: grid !important;
|
| 289 |
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
|
| 290 |
+
gap: 8px !important;
|
| 291 |
+
padding: 16px !important;
|
| 292 |
+
margin: 0 !important;
|
| 293 |
}
|
| 294 |
|
| 295 |
.example {
|
| 296 |
+
background: #334155 !important;
|
| 297 |
+
border: 1px solid #475569 !important;
|
| 298 |
+
color: #e2e8f0 !important;
|
| 299 |
+
padding: 10px 14px !important;
|
| 300 |
+
border-radius: 6px !important;
|
| 301 |
+
font-size: 0.85rem !important;
|
| 302 |
cursor: pointer !important;
|
| 303 |
+
transition: all 0.2s ease !important;
|
|
|
|
| 304 |
}
|
| 305 |
|
| 306 |
.example:hover {
|
| 307 |
+
background: #475569 !important;
|
| 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 |
.office-grid {
|
| 330 |
+
display: flex !important;
|
| 331 |
+
justify-content: center !important;
|
| 332 |
+
gap: 24px !important;
|
| 333 |
+
margin: 16px 0 !important;
|
| 334 |
+
flex-wrap: wrap !important;
|
| 335 |
}
|
| 336 |
|
| 337 |
.office-item {
|
| 338 |
+
background: #334155 !important;
|
| 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 |
.office-item h4 {
|
| 347 |
+
color: #06b6d4 !important;
|
| 348 |
+
font-size: 0.9rem !important;
|
| 349 |
font-weight: 600 !important;
|
| 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 |
+
/* Remove extra spacing */
|
| 360 |
+
.gradio-container * {
|
| 361 |
+
box-sizing: border-box !important;
|
| 362 |
}
|
| 363 |
|
| 364 |
/* Responsive */
|
| 365 |
@media (max-width: 768px) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
.message.user {
|
| 367 |
+
margin-left: 15% !important;
|
| 368 |
}
|
| 369 |
|
| 370 |
.message.bot {
|
| 371 |
+
margin-right: 15% !important;
|
| 372 |
}
|
| 373 |
|
| 374 |
.examples {
|
| 375 |
grid-template-columns: 1fr !important;
|
| 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 |
+
::-webkit-scrollbar-thumb {
|
| 404 |
+
background: #475569;
|
| 405 |
+
border-radius: 3px;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
::-webkit-scrollbar-thumb:hover {
|
| 409 |
+
background: #3b82f6;
|
| 410 |
}
|
| 411 |
"""
|
| 412 |
|
| 413 |
+
# Create clean interface
|
| 414 |
with gr.Blocks(
|
| 415 |
+
title="4AT Professional Assistant",
|
| 416 |
+
css=clean_css,
|
| 417 |
+
theme=gr.themes.Base()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
) as demo:
|
| 419 |
|
| 420 |
+
# Clean header
|
| 421 |
gr.HTML("""
|
| 422 |
+
<div class="header">
|
| 423 |
+
<h1>🤖 4AT Professional Assistant</h1>
|
| 424 |
+
<p>Expert AI for Accounting, Audit, Advisory & Technology Services</p>
|
| 425 |
+
<p style="font-size: 0.85rem; color: #64748b;">Ask about our services, team, clients, or business solutions</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 426 |
</div>
|
| 427 |
""")
|
| 428 |
|
| 429 |
+
# Clean chat interface
|
| 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 LLP</h3>
|
| 450 |
+
<p style="color: #94a3b8; margin-bottom: 16px;">Accounting • Audit • Advisory • Technology</p>
|
|
|
|
|
|
|
| 451 |
|
| 452 |
<div class="office-grid">
|
| 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 |
|