Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -584,8 +584,8 @@ def nlp_pipeline(original_df):
|
|
| 584 |
print("Clustering Done...")
|
| 585 |
# return processed_df, budget_cluster_df, problem_cluster_df, location_clusters, problem_clusters
|
| 586 |
|
| 587 |
-
print("\n
|
| 588 |
-
print("\n
|
| 589 |
# # Generate project proposals
|
| 590 |
# location_clusters = dict(enumerate(processed_df['Location_Category_Words'].unique()))
|
| 591 |
# problem_clusters = dict(enumerate(processed_df['Problem_Category_Words'].unique()))
|
|
@@ -698,20 +698,35 @@ def process_excel(file):
|
|
| 698 |
consoleMessage_and_Print("Error during Project Proposal excelling at the end")
|
| 699 |
|
| 700 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 701 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 702 |
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
location_clusters.to_excel(writer, sheet_name='Location_Clusters', index=False)
|
| 706 |
-
else:
|
| 707 |
-
consoleMessage_and_Print("Converting Location Clusters to df")
|
| 708 |
-
pd.DataFrame(location_clusters).to_excel(writer, sheet_name='Location_Clusters', index=False)
|
| 709 |
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 715 |
|
| 716 |
|
| 717 |
|
|
|
|
| 584 |
print("Clustering Done...")
|
| 585 |
# return processed_df, budget_cluster_df, problem_cluster_df, location_clusters, problem_clusters
|
| 586 |
|
| 587 |
+
print("\n location_clusters: ", location_clusters)
|
| 588 |
+
print("\n problem_clusters: ", problem_clusters)
|
| 589 |
# # Generate project proposals
|
| 590 |
# location_clusters = dict(enumerate(processed_df['Location_Category_Words'].unique()))
|
| 591 |
# problem_clusters = dict(enumerate(processed_df['Problem_Category_Words'].unique()))
|
|
|
|
| 698 |
consoleMessage_and_Print("Error during Project Proposal excelling at the end")
|
| 699 |
|
| 700 |
|
| 701 |
+
try:
|
| 702 |
+
location_clusters_df = pd.DataFrame({'Cluster_Id': list(location_clusters.keys()),
|
| 703 |
+
'Location_Cluster': list(location_clusters.values())})
|
| 704 |
+
location_clusters_df.to_excel(writer, sheet_name='Location_Clusters', index=False)
|
| 705 |
+
|
| 706 |
+
except error:
|
| 707 |
+
consoleMessage_and_Print("Error during Location Cluster Dataframing")
|
| 708 |
|
| 709 |
+
try:
|
| 710 |
+
problem_clusters_df = pd.DataFrame({'Cluster_Id': list(location_clusters.keys()),
|
| 711 |
+
'Problem_Cluster': list(location_clusters.values())})
|
| 712 |
+
problem_clusters_df.to_excel(writer, sheet_name='Problem_Clusters', index=False)
|
| 713 |
|
| 714 |
+
except error:
|
| 715 |
+
consoleMessage_and_Print("Error during Problem Cluster Dataframing")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 716 |
|
| 717 |
+
|
| 718 |
+
# # Ensure location_clusters and problem_clusters are in DataFrame format
|
| 719 |
+
# if isinstance(location_clusters, pd.DataFrame):
|
| 720 |
+
# location_clusters.to_excel(writer, sheet_name='Location_Clusters', index=False)
|
| 721 |
+
# else:
|
| 722 |
+
# consoleMessage_and_Print("Converting Location Clusters to df")
|
| 723 |
+
# pd.DataFrame(location_clusters).to_excel(writer, sheet_name='Location_Clusters', index=False)
|
| 724 |
+
|
| 725 |
+
# if isinstance(problem_clusters, pd.DataFrame):
|
| 726 |
+
# problem_clusters.to_excel(writer, sheet_name='Problem_Clusters', index=False)
|
| 727 |
+
# else:
|
| 728 |
+
# consoleMessage_and_Print("Converting Problem Clusters to df")
|
| 729 |
+
# pd.DataFrame(problem_clusters).to_excel(writer, sheet_name='Problem_Clusters', index=False)
|
| 730 |
|
| 731 |
|
| 732 |
|