Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -465,8 +465,8 @@ def nlp_pipeline(original_df):
|
|
| 465 |
# return processed_df, budget_cluster_df, problem_cluster_df, location_clusters, problem_clusters
|
| 466 |
|
| 467 |
# # Generate project proposals
|
| 468 |
-
|
| 469 |
-
|
| 470 |
project_proposals = create_project_proposals(budget_cluster_df, problem_cluster_df, location_clusters, problem_clusters)
|
| 471 |
|
| 472 |
console_messages.append("NLP pipeline completed.")
|
|
@@ -507,18 +507,18 @@ def process_excel(file):
|
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
-
#
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
|
| 523 |
|
| 524 |
|
|
|
|
| 465 |
# return processed_df, budget_cluster_df, problem_cluster_df, location_clusters, problem_clusters
|
| 466 |
|
| 467 |
# # Generate project proposals
|
| 468 |
+
location_clusters = dict(enumerate(processed_df['Location_Category_Words'].unique()))
|
| 469 |
+
problem_clusters = dict(enumerate(processed_df['Problem_Category_Words'].unique()))
|
| 470 |
project_proposals = create_project_proposals(budget_cluster_df, problem_cluster_df, location_clusters, problem_clusters)
|
| 471 |
|
| 472 |
console_messages.append("NLP pipeline completed.")
|
|
|
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
+
# Ensure location_clusters and problem_clusters are in DataFrame format
|
| 511 |
+
if isinstance(location_clusters, pd.DataFrame):
|
| 512 |
+
location_clusters.to_excel(writer, sheet_name='Location_Clusters', index=False)
|
| 513 |
+
else:
|
| 514 |
+
console_messages.append("Converting Location Clusters to df")
|
| 515 |
+
pd.DataFrame(location_clusters).to_excel(writer, sheet_name='Location_Clusters', index=False)
|
| 516 |
|
| 517 |
+
if isinstance(problem_clusters, pd.DataFrame):
|
| 518 |
+
problem_clusters.to_excel(writer, sheet_name='Problem_Clusters', index=False)
|
| 519 |
+
else:
|
| 520 |
+
console_messages.append("Converting Problem Clusters to df")
|
| 521 |
+
pd.DataFrame(problem_clusters).to_excel(writer, sheet_name='Problem_Clusters', index=False)
|
| 522 |
|
| 523 |
|
| 524 |
|