Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -317,6 +317,8 @@ def create_matches_dataframes(matches: Dict, users_data: Dict) -> List[Tuple[str
|
|
| 317 |
'Match Name': match.get('fullName', cid),
|
| 318 |
'Role': match.get('currentRole', 'Unknown'),
|
| 319 |
'Field': match.get('primaryField', 'Unknown'),
|
|
|
|
|
|
|
| 320 |
'Experience': match.get('experienceLevel', 'Unknown'),
|
| 321 |
'Education': match.get('education', 'Unknown'),
|
| 322 |
'Skills': match_skills_str,
|
|
@@ -327,8 +329,8 @@ def create_matches_dataframes(matches: Dict, users_data: Dict) -> List[Tuple[str
|
|
| 327 |
'Commitment': match.get('commitmentLevel', 'Unknown'),
|
| 328 |
'Availability': match.get('availability', 'Unknown'),
|
| 329 |
'Total Score': f"{match_data['score']:.3f}",
|
| 330 |
-
'Goal Similarity': f"{match_data['breakdown']['goal_similarity']:.3f}
|
| 331 |
-
'Profile Similarity': f"{match_data['breakdown']['profile_similarity']:.3f}
|
| 332 |
'Confidence': f"[{conf_bar}] {confidence*100:.0f}%",
|
| 333 |
'Why Connect': match_data['why_connect'],
|
| 334 |
'Conversation Starters': starters_text
|
|
@@ -378,13 +380,20 @@ def process_matching(profile_text: str, num_matches: int) -> Tuple[str, str]:
|
|
| 378 |
processing_time = end_time - start_time
|
| 379 |
|
| 380 |
# Create HTML output with all tables
|
| 381 |
-
html_output = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
|
| 383 |
for header, df in user_dataframes:
|
| 384 |
html_output += f"""
|
| 385 |
-
<div style='margin-bottom: 40px; border: 2px solid #e0e0e0; border-radius: 10px; padding: 20px; background: #f9f9f9;'>
|
| 386 |
<h3 style='color: #2c3e50; margin-bottom: 15px; border-bottom: 2px solid #3498db; padding-bottom: 10px; white-space: pre-line;'>{header}</h3>
|
| 387 |
-
|
|
|
|
|
|
|
| 388 |
</div>
|
| 389 |
"""
|
| 390 |
|
|
@@ -399,6 +408,8 @@ def process_matching(profile_text: str, num_matches: int) -> Tuple[str, str]:
|
|
| 399 |
font-size: 14px;
|
| 400 |
background-color: #000000;
|
| 401 |
color: #ffffff;
|
|
|
|
|
|
|
| 402 |
}}
|
| 403 |
.dataframe th {{
|
| 404 |
background-color: #000000;
|
|
@@ -407,6 +418,10 @@ def process_matching(profile_text: str, num_matches: int) -> Tuple[str, str]:
|
|
| 407 |
text-align: left;
|
| 408 |
font-weight: bold;
|
| 409 |
border: 1px solid #333333;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
}}
|
| 411 |
.dataframe td {{
|
| 412 |
padding: 10px;
|
|
@@ -414,6 +429,9 @@ def process_matching(profile_text: str, num_matches: int) -> Tuple[str, str]:
|
|
| 414 |
vertical-align: top;
|
| 415 |
color: #ffffff;
|
| 416 |
background-color: #000000;
|
|
|
|
|
|
|
|
|
|
| 417 |
}}
|
| 418 |
.dataframe tr:hover {{
|
| 419 |
background-color: #1a1a1a;
|
|
@@ -421,6 +439,22 @@ def process_matching(profile_text: str, num_matches: int) -> Tuple[str, str]:
|
|
| 421 |
.dataframe tr:hover td {{
|
| 422 |
background-color: #1a1a1a;
|
| 423 |
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
</style>
|
| 425 |
{html_output}
|
| 426 |
"""
|
|
|
|
| 317 |
'Match Name': match.get('fullName', cid),
|
| 318 |
'Role': match.get('currentRole', 'Unknown'),
|
| 319 |
'Field': match.get('primaryField', 'Unknown'),
|
| 320 |
+
'Field of Study': match.get('fieldOfStudy', 'Unknown'),
|
| 321 |
+
'Professional Summary': match.get('professionalSummary', 'Not provided'),
|
| 322 |
'Experience': match.get('experienceLevel', 'Unknown'),
|
| 323 |
'Education': match.get('education', 'Unknown'),
|
| 324 |
'Skills': match_skills_str,
|
|
|
|
| 329 |
'Commitment': match.get('commitmentLevel', 'Unknown'),
|
| 330 |
'Availability': match.get('availability', 'Unknown'),
|
| 331 |
'Total Score': f"{match_data['score']:.3f}",
|
| 332 |
+
'Goal Similarity': f"{match_data['breakdown']['goal_similarity']:.3f}",
|
| 333 |
+
'Profile Similarity': f"{match_data['breakdown']['profile_similarity']:.3f}",
|
| 334 |
'Confidence': f"[{conf_bar}] {confidence*100:.0f}%",
|
| 335 |
'Why Connect': match_data['why_connect'],
|
| 336 |
'Conversation Starters': starters_text
|
|
|
|
| 380 |
processing_time = end_time - start_time
|
| 381 |
|
| 382 |
# Create HTML output with all tables
|
| 383 |
+
html_output = f"""
|
| 384 |
+
<div style='font-family: Arial, sans-serif;'>
|
| 385 |
+
<div style='position: sticky; top: 0; right: 0; text-align: right; background-color: #2ecc71; color: white; padding: 10px 20px; border-radius: 5px; margin-bottom: 20px; font-weight: bold; z-index: 100; box-shadow: 0 2px 5px rgba(0,0,0,0.2);'>
|
| 386 |
+
⏱️ Processing Time: {processing_time:.2f} seconds
|
| 387 |
+
</div>
|
| 388 |
+
"""
|
| 389 |
|
| 390 |
for header, df in user_dataframes:
|
| 391 |
html_output += f"""
|
| 392 |
+
<div style='margin-bottom: 40px; border: 2px solid #e0e0e0; border-radius: 10px; padding: 20px; background: #f9f9f9; overflow-x: auto;'>
|
| 393 |
<h3 style='color: #2c3e50; margin-bottom: 15px; border-bottom: 2px solid #3498db; padding-bottom: 10px; white-space: pre-line;'>{header}</h3>
|
| 394 |
+
<div style='overflow-x: auto; max-width: 100%;'>
|
| 395 |
+
{df.to_html(index=False, escape=False, classes='dataframe')}
|
| 396 |
+
</div>
|
| 397 |
</div>
|
| 398 |
"""
|
| 399 |
|
|
|
|
| 408 |
font-size: 14px;
|
| 409 |
background-color: #000000;
|
| 410 |
color: #ffffff;
|
| 411 |
+
min-width: 800px;
|
| 412 |
+
table-layout: auto;
|
| 413 |
}}
|
| 414 |
.dataframe th {{
|
| 415 |
background-color: #000000;
|
|
|
|
| 418 |
text-align: left;
|
| 419 |
font-weight: bold;
|
| 420 |
border: 1px solid #333333;
|
| 421 |
+
white-space: nowrap;
|
| 422 |
+
position: sticky;
|
| 423 |
+
top: 0;
|
| 424 |
+
z-index: 10;
|
| 425 |
}}
|
| 426 |
.dataframe td {{
|
| 427 |
padding: 10px;
|
|
|
|
| 429 |
vertical-align: top;
|
| 430 |
color: #ffffff;
|
| 431 |
background-color: #000000;
|
| 432 |
+
max-width: 300px;
|
| 433 |
+
word-wrap: break-word;
|
| 434 |
+
overflow-wrap: break-word;
|
| 435 |
}}
|
| 436 |
.dataframe tr:hover {{
|
| 437 |
background-color: #1a1a1a;
|
|
|
|
| 439 |
.dataframe tr:hover td {{
|
| 440 |
background-color: #1a1a1a;
|
| 441 |
}}
|
| 442 |
+
/* Responsive container */
|
| 443 |
+
div[style*='overflow-x: auto'] {{
|
| 444 |
+
-webkit-overflow-scrolling: touch;
|
| 445 |
+
}}
|
| 446 |
+
/* Make specific columns wrap text */
|
| 447 |
+
.dataframe td:nth-child(6), /* Professional Summary */
|
| 448 |
+
.dataframe td:nth-child(9), /* Skills */
|
| 449 |
+
.dataframe td:nth-child(10), /* Achievements */
|
| 450 |
+
.dataframe td:nth-child(11), /* Looking For */
|
| 451 |
+
.dataframe td:nth-child(12), /* Offering */
|
| 452 |
+
.dataframe td:nth-child(20), /* Why Connect */
|
| 453 |
+
.dataframe td:nth-child(21) /* Conversation Starters */
|
| 454 |
+
{{
|
| 455 |
+
max-width: 250px;
|
| 456 |
+
white-space: normal;
|
| 457 |
+
}}
|
| 458 |
</style>
|
| 459 |
{html_output}
|
| 460 |
"""
|