Update app.py
Browse files
app.py
CHANGED
|
@@ -274,17 +274,20 @@ def search_website_contacts(website_url, max_results=10):
|
|
| 274 |
contacts = contacts[:max_results]
|
| 275 |
|
| 276 |
# Format results
|
| 277 |
-
results_text = f"
|
|
|
|
|
|
|
|
|
|
| 278 |
|
| 279 |
contact_data = []
|
| 280 |
for i, contact in enumerate(contacts, 1):
|
| 281 |
-
results_text += f"**
|
| 282 |
-
results_text += f"
|
| 283 |
-
results_text += f"
|
| 284 |
-
results_text += f"
|
| 285 |
-
results_text += f"
|
| 286 |
-
results_text += f"
|
| 287 |
-
results_text += f"
|
| 288 |
|
| 289 |
# Prepare data for CSV/table format
|
| 290 |
contact_data.append([
|
|
@@ -311,85 +314,235 @@ def get_all_available_websites():
|
|
| 311 |
websites = list(set([contact['website'] for contact in CONTACTS_DB]))
|
| 312 |
return "\n".join(sorted(websites))
|
| 313 |
|
| 314 |
-
#
|
| 315 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
gr.HTML("""
|
| 317 |
-
<div
|
| 318 |
-
<h1
|
| 319 |
-
<p>
|
|
|
|
| 320 |
</div>
|
| 321 |
""")
|
| 322 |
|
| 323 |
with gr.Row():
|
| 324 |
-
with gr.Column(scale=
|
| 325 |
-
|
| 326 |
-
label="Website URL",
|
| 327 |
-
placeholder="Enter website URL (e.g., techflowsolutions.com or https://greenleafconsult.com)",
|
| 328 |
-
value=""
|
| 329 |
-
)
|
| 330 |
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
value=
|
| 335 |
-
|
| 336 |
-
label="Maximum Results"
|
| 337 |
)
|
| 338 |
|
| 339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
|
| 341 |
-
with gr.Column(scale=
|
| 342 |
gr.HTML("""
|
| 343 |
-
<div
|
| 344 |
-
<h3
|
| 345 |
-
<ul>
|
| 346 |
-
<li>
|
| 347 |
-
<li>
|
| 348 |
-
<li>
|
| 349 |
-
<li>
|
| 350 |
</ul>
|
|
|
|
|
|
|
|
|
|
| 351 |
</div>
|
| 352 |
""")
|
| 353 |
|
|
|
|
|
|
|
| 354 |
with gr.Row():
|
| 355 |
results_display = gr.Textbox(
|
| 356 |
-
label="Contact
|
| 357 |
-
lines=
|
| 358 |
-
max_lines=
|
| 359 |
-
show_copy_button=True
|
|
|
|
| 360 |
)
|
| 361 |
|
| 362 |
csv_output = gr.Textbox(
|
| 363 |
-
label="
|
| 364 |
-
lines=
|
| 365 |
-
max_lines=
|
| 366 |
-
show_copy_button=True
|
|
|
|
| 367 |
)
|
| 368 |
|
| 369 |
# Sample websites section
|
| 370 |
-
with gr.Accordion("
|
|
|
|
| 371 |
sample_websites = gr.Textbox(
|
| 372 |
-
label="
|
| 373 |
value=get_all_available_websites(),
|
| 374 |
-
lines=
|
| 375 |
-
interactive=False
|
|
|
|
| 376 |
)
|
|
|
|
| 377 |
|
| 378 |
-
# Quick search buttons
|
| 379 |
-
|
| 380 |
-
gr.HTML("<h3>π Quick Search Sample Websites:</h3>")
|
| 381 |
|
| 382 |
with gr.Row():
|
| 383 |
-
quick_btn1 = gr.Button("TechFlow Solutions", size="sm")
|
| 384 |
-
quick_btn2 = gr.Button("GreenLeaf Consulting", size="sm")
|
| 385 |
-
quick_btn3 = gr.Button("BlueSky Marketing", size="sm")
|
| 386 |
-
quick_btn4 = gr.Button("Quantum Dynamics", size="sm")
|
| 387 |
|
| 388 |
with gr.Row():
|
| 389 |
-
quick_btn5 = gr.Button("Stellar Logistics", size="sm")
|
| 390 |
-
quick_btn6 = gr.Button("Nexus Financial", size="sm")
|
| 391 |
-
quick_btn7 = gr.Button("Horizon Health", size="sm")
|
| 392 |
-
quick_btn8 = gr.Button("Phoenix Manufacturing", size="sm")
|
| 393 |
|
| 394 |
# Event handlers
|
| 395 |
search_btn.click(
|
|
@@ -412,12 +565,22 @@ with gr.Blocks(title="Website Contact Finder", theme=gr.themes.Soft()) as app:
|
|
| 412 |
gr.Examples(
|
| 413 |
examples=[
|
| 414 |
["techflowsolutions.com", 5],
|
| 415 |
-
["
|
| 416 |
-
["blueskymarketing.net",
|
| 417 |
-
["quantumdynamics.org",
|
| 418 |
],
|
| 419 |
-
inputs=[website_input, max_results]
|
|
|
|
| 420 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
|
| 422 |
if __name__ == "__main__":
|
| 423 |
app.launch()
|
|
|
|
| 274 |
contacts = contacts[:max_results]
|
| 275 |
|
| 276 |
# Format results
|
| 277 |
+
results_text = f"π **CONTACT INTELLIGENCE REPORT**\n"
|
| 278 |
+
results_text += f"π **Website:** {website_url}\n"
|
| 279 |
+
results_text += f"π **Contacts Found:** {len(contacts)}\n"
|
| 280 |
+
results_text += f"{'='*60}\n\n"
|
| 281 |
|
| 282 |
contact_data = []
|
| 283 |
for i, contact in enumerate(contacts, 1):
|
| 284 |
+
results_text += f"π’ **CONTACT #{i}**\n"
|
| 285 |
+
results_text += f"ββ **First Name:** {contact['first_name']}\n"
|
| 286 |
+
results_text += f"ββ **Last Name:** {contact['last_name']}\n"
|
| 287 |
+
results_text += f"ββ **Position:** {contact['job_title']}\n"
|
| 288 |
+
results_text += f"ββ **Email:** {contact['email']}\n"
|
| 289 |
+
results_text += f"ββ **Phone:** {contact['phone']}\n"
|
| 290 |
+
results_text += f"ββ **Company:** {contact['company']}\n\n"
|
| 291 |
|
| 292 |
# Prepare data for CSV/table format
|
| 293 |
contact_data.append([
|
|
|
|
| 314 |
websites = list(set([contact['website'] for contact in CONTACTS_DB]))
|
| 315 |
return "\n".join(sorted(websites))
|
| 316 |
|
| 317 |
+
# Custom CSS matching Kwekel Companies professional theme
|
| 318 |
+
custom_css = """
|
| 319 |
+
/* Kwekel-inspired Corporate Theme */
|
| 320 |
+
.gradio-container {
|
| 321 |
+
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
| 322 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
.main-header {
|
| 326 |
+
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1e40af 100%);
|
| 327 |
+
color: white;
|
| 328 |
+
padding: 40px 20px;
|
| 329 |
+
text-align: center;
|
| 330 |
+
border-radius: 15px;
|
| 331 |
+
margin-bottom: 30px;
|
| 332 |
+
box-shadow: 0 10px 30px rgba(30, 58, 138, 0.3);
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
.main-header h1 {
|
| 336 |
+
font-size: 2.5em;
|
| 337 |
+
margin: 0;
|
| 338 |
+
font-weight: 700;
|
| 339 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
.main-header p {
|
| 343 |
+
font-size: 1.2em;
|
| 344 |
+
margin: 15px 0 0 0;
|
| 345 |
+
opacity: 0.9;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
.corporate-card {
|
| 349 |
+
background: white;
|
| 350 |
+
border: 1px solid #d1d5db;
|
| 351 |
+
border-radius: 12px;
|
| 352 |
+
padding: 25px;
|
| 353 |
+
margin: 15px 0;
|
| 354 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
| 355 |
+
border-left: 5px solid #1e40af;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
.tips-section {
|
| 359 |
+
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
|
| 360 |
+
border: 2px solid #cbd5e1;
|
| 361 |
+
border-radius: 15px;
|
| 362 |
+
padding: 20px;
|
| 363 |
+
margin: 10px 0;
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
.tips-section h3 {
|
| 367 |
+
color: #1e40af;
|
| 368 |
+
margin-top: 0;
|
| 369 |
+
font-weight: 600;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
.quick-search-grid {
|
| 373 |
+
display: grid;
|
| 374 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 375 |
+
gap: 10px;
|
| 376 |
+
margin: 20px 0;
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
/* Button Styling */
|
| 380 |
+
.primary-btn {
|
| 381 |
+
background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
|
| 382 |
+
color: white;
|
| 383 |
+
border: none;
|
| 384 |
+
border-radius: 8px;
|
| 385 |
+
padding: 15px 30px;
|
| 386 |
+
font-weight: 600;
|
| 387 |
+
font-size: 16px;
|
| 388 |
+
transition: all 0.3s ease;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
.primary-btn:hover {
|
| 392 |
+
background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
|
| 393 |
+
transform: translateY(-2px);
|
| 394 |
+
box-shadow: 0 6px 20px rgba(30, 64, 175, 0.4);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
.secondary-btn {
|
| 398 |
+
background: white;
|
| 399 |
+
color: #374151;
|
| 400 |
+
border: 2px solid #d1d5db;
|
| 401 |
+
border-radius: 6px;
|
| 402 |
+
padding: 8px 16px;
|
| 403 |
+
font-weight: 500;
|
| 404 |
+
transition: all 0.3s ease;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
.secondary-btn:hover {
|
| 408 |
+
border-color: #1e40af;
|
| 409 |
+
color: #1e40af;
|
| 410 |
+
background: #f8fafc;
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
/* Input Fields */
|
| 414 |
+
.custom-input {
|
| 415 |
+
border: 2px solid #d1d5db;
|
| 416 |
+
border-radius: 8px;
|
| 417 |
+
padding: 12px;
|
| 418 |
+
font-size: 16px;
|
| 419 |
+
transition: border-color 0.3s ease;
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
.custom-input:focus {
|
| 423 |
+
border-color: #3b82f6;
|
| 424 |
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
/* Results Styling */
|
| 428 |
+
.results-container {
|
| 429 |
+
background: white;
|
| 430 |
+
border: 1px solid #e5e7eb;
|
| 431 |
+
border-radius: 10px;
|
| 432 |
+
padding: 20px;
|
| 433 |
+
margin: 15px 0;
|
| 434 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
.section-header {
|
| 438 |
+
background: linear-gradient(135deg, #64748b 0%, #475569 100%);
|
| 439 |
+
color: white;
|
| 440 |
+
padding: 15px 20px;
|
| 441 |
+
border-radius: 10px;
|
| 442 |
+
margin: 20px 0 15px 0;
|
| 443 |
+
font-weight: 600;
|
| 444 |
+
}
|
| 445 |
+
"""
|
| 446 |
+
|
| 447 |
+
# Create Gradio interface with custom theme
|
| 448 |
+
with gr.Blocks(css=custom_css, title="Kwekel Contact Intelligence", theme=gr.themes.Base()) as app:
|
| 449 |
gr.HTML("""
|
| 450 |
+
<div class="main-header">
|
| 451 |
+
<h1>π’ KWEKEL CONTACT INTELLIGENCE</h1>
|
| 452 |
+
<p>Professional Contact Discovery & Lead Generation Platform</p>
|
| 453 |
+
<p style="font-size: 0.95em; opacity: 0.8;">Advanced website analysis for corporate intelligence gathering</p>
|
| 454 |
</div>
|
| 455 |
""")
|
| 456 |
|
| 457 |
with gr.Row():
|
| 458 |
+
with gr.Column(scale=3):
|
| 459 |
+
gr.HTML('<div class="section-header">π SEARCH PARAMETERS</div>')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
|
| 461 |
+
website_input = gr.Textbox(
|
| 462 |
+
label="π Target Website URL",
|
| 463 |
+
placeholder="Enter company website (e.g., techflowsolutions.com)",
|
| 464 |
+
value="",
|
| 465 |
+
elem_classes=["custom-input"]
|
|
|
|
| 466 |
)
|
| 467 |
|
| 468 |
+
with gr.Row():
|
| 469 |
+
max_results = gr.Slider(
|
| 470 |
+
minimum=1,
|
| 471 |
+
maximum=20,
|
| 472 |
+
value=8,
|
| 473 |
+
step=1,
|
| 474 |
+
label="π Maximum Results",
|
| 475 |
+
elem_classes=["custom-input"]
|
| 476 |
+
)
|
| 477 |
+
|
| 478 |
+
search_btn = gr.Button(
|
| 479 |
+
"π EXECUTE SEARCH",
|
| 480 |
+
variant="primary",
|
| 481 |
+
size="lg",
|
| 482 |
+
elem_classes=["primary-btn"]
|
| 483 |
+
)
|
| 484 |
|
| 485 |
+
with gr.Column(scale=2):
|
| 486 |
gr.HTML("""
|
| 487 |
+
<div class="tips-section">
|
| 488 |
+
<h3>πΌ CORPORATE INTELLIGENCE</h3>
|
| 489 |
+
<ul style="margin: 10px 0; padding-left: 20px;">
|
| 490 |
+
<li><strong>Real-Time Analysis:</strong> Live website scanning</li>
|
| 491 |
+
<li><strong>Executive Contacts:</strong> C-level and key personnel</li>
|
| 492 |
+
<li><strong>Direct Communications:</strong> Email & phone verification</li>
|
| 493 |
+
<li><strong>Export Ready:</strong> CSV format for CRM integration</li>
|
| 494 |
</ul>
|
| 495 |
+
<div style="background: #1e40af; color: white; padding: 10px; border-radius: 5px; margin-top: 15px; text-align: center; font-weight: 600;">
|
| 496 |
+
ENTERPRISE-GRADE CONTACT DISCOVERY
|
| 497 |
+
</div>
|
| 498 |
</div>
|
| 499 |
""")
|
| 500 |
|
| 501 |
+
gr.HTML('<div class="section-header">π INTELLIGENCE RESULTS</div>')
|
| 502 |
+
|
| 503 |
with gr.Row():
|
| 504 |
results_display = gr.Textbox(
|
| 505 |
+
label="π Contact Intelligence Report",
|
| 506 |
+
lines=18,
|
| 507 |
+
max_lines=35,
|
| 508 |
+
show_copy_button=True,
|
| 509 |
+
elem_classes=["results-container"]
|
| 510 |
)
|
| 511 |
|
| 512 |
csv_output = gr.Textbox(
|
| 513 |
+
label="π Export Data (CSV Format)",
|
| 514 |
+
lines=18,
|
| 515 |
+
max_lines=35,
|
| 516 |
+
show_copy_button=True,
|
| 517 |
+
elem_classes=["results-container"]
|
| 518 |
)
|
| 519 |
|
| 520 |
# Sample websites section
|
| 521 |
+
with gr.Accordion("π’ CORPORATE DATABASE SAMPLES", open=False):
|
| 522 |
+
gr.HTML('<div style="background: #f8fafc; padding: 15px; border-radius: 8px; border-left: 4px solid #1e40af;">')
|
| 523 |
sample_websites = gr.Textbox(
|
| 524 |
+
label="Available Corporate Websites in Database",
|
| 525 |
value=get_all_available_websites(),
|
| 526 |
+
lines=8,
|
| 527 |
+
interactive=False,
|
| 528 |
+
elem_classes=["custom-input"]
|
| 529 |
)
|
| 530 |
+
gr.HTML('</div>')
|
| 531 |
|
| 532 |
+
# Quick search buttons
|
| 533 |
+
gr.HTML('<div class="section-header">β‘ QUICK ACCESS CORPORATE TARGETS</div>')
|
|
|
|
| 534 |
|
| 535 |
with gr.Row():
|
| 536 |
+
quick_btn1 = gr.Button("π· TechFlow Solutions", size="sm", elem_classes=["secondary-btn"])
|
| 537 |
+
quick_btn2 = gr.Button("πΏ GreenLeaf Consulting", size="sm", elem_classes=["secondary-btn"])
|
| 538 |
+
quick_btn3 = gr.Button("π― BlueSky Marketing", size="sm", elem_classes=["secondary-btn"])
|
| 539 |
+
quick_btn4 = gr.Button("βοΈ Quantum Dynamics", size="sm", elem_classes=["secondary-btn"])
|
| 540 |
|
| 541 |
with gr.Row():
|
| 542 |
+
quick_btn5 = gr.Button("π¦ Stellar Logistics", size="sm", elem_classes=["secondary-btn"])
|
| 543 |
+
quick_btn6 = gr.Button("π° Nexus Financial", size="sm", elem_classes=["secondary-btn"])
|
| 544 |
+
quick_btn7 = gr.Button("π₯ Horizon Health", size="sm", elem_classes=["secondary-btn"])
|
| 545 |
+
quick_btn8 = gr.Button("π Phoenix Manufacturing", size="sm", elem_classes=["secondary-btn"])
|
| 546 |
|
| 547 |
# Event handlers
|
| 548 |
search_btn.click(
|
|
|
|
| 565 |
gr.Examples(
|
| 566 |
examples=[
|
| 567 |
["techflowsolutions.com", 5],
|
| 568 |
+
["greenleafconsult.com", 3],
|
| 569 |
+
["blueskymarketing.net", 4],
|
| 570 |
+
["quantumdynamics.org", 6]
|
| 571 |
],
|
| 572 |
+
inputs=[website_input, max_results],
|
| 573 |
+
label="π― Sample Corporate Searches"
|
| 574 |
)
|
| 575 |
+
|
| 576 |
+
# Footer
|
| 577 |
+
gr.HTML("""
|
| 578 |
+
<div style="text-align: center; padding: 30px 20px; background: linear-gradient(135deg, #64748b 0%, #475569 100%); color: white; border-radius: 15px; margin-top: 30px;">
|
| 579 |
+
<h3 style="margin: 0 0 10px 0;">KWEKEL CONTACT INTELLIGENCE PLATFORM</h3>
|
| 580 |
+
<p style="margin: 0; opacity: 0.9;">Professional-grade corporate contact discovery and lead generation technology</p>
|
| 581 |
+
<p style="margin: 10px 0 0 0; font-size: 0.9em; opacity: 0.7;">Powered by advanced web intelligence algorithms</p>
|
| 582 |
+
</div>
|
| 583 |
+
""")
|
| 584 |
|
| 585 |
if __name__ == "__main__":
|
| 586 |
app.launch()
|