SantanuBanerjee commited on
Commit
df711e3
·
verified ·
1 Parent(s): 93c16af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -342,31 +342,32 @@ def nlp_pipeline(original_df, console_messages):
342
  print(f"Optimal clusters: {optimal_clusters}")
343
  print(result_df.head())
344
  # console_messages.append(f"Optimal clusters: {optimal_n_clusters}")
 
 
 
345
  except Exception as e:
346
- print(f"Error in extract_problem_domains: {e}")
347
- # console_messages.append(f"Error in extract_problem_domains: {str(e)}")
 
 
348
 
349
 
350
  # problem_clusters, problem_model = perform_clustering(processed_df['Problem_Description'], n_clusters=10)
351
  # location_clusters, location_model = perform_clustering(processed_df['Geographical_Location'], n_clusters=5)
352
 
353
 
354
- console_messages.append("NLP pipeline completed.")
355
- # return processed_df
356
- return domain_df, console_messages
357
 
358
 
359
  def process_excel(file):
360
  console_messages = []
361
- console_messages.append("Processing starts...")
362
-
 
 
 
 
363
  try:
364
- # Ensure the file path is correct
365
- console_messages.append("Reading the uploaded Excel file...")
366
- file_path = file.name if hasattr(file, 'name') else file
367
- # Read the Excel file
368
- df = pd.read_excel(file_path)
369
-
370
  # Process the DataFrame
371
  console_messages.append("Processing the DataFrame...")
372
  result_df, console_messages = nlp_pipeline(df, console_messages)
 
342
  print(f"Optimal clusters: {optimal_clusters}")
343
  print(result_df.head())
344
  # console_messages.append(f"Optimal clusters: {optimal_n_clusters}")
345
+
346
+ console_messages.append("NLP pipeline completed.")
347
+ return domain_df, console_messages
348
  except Exception as e:
349
+ # print(f"Error in extract_problem_domains: {e}")
350
+ console_messages.append(f"Error in extract_problem_domains: {str(e)}")
351
+ # return processed_df, console_messages
352
+ return domain_df, console_messages
353
 
354
 
355
  # problem_clusters, problem_model = perform_clustering(processed_df['Problem_Description'], n_clusters=10)
356
  # location_clusters, location_model = perform_clustering(processed_df['Geographical_Location'], n_clusters=5)
357
 
358
 
359
+
 
 
360
 
361
 
362
  def process_excel(file):
363
  console_messages = []
364
+ console_messages.append("Processing starts. Reading the uploaded Excel file...")
365
+ # Ensure the file path is correct
366
+ file_path = file.name if hasattr(file, 'name') else file
367
+ # Read the Excel file
368
+ df = pd.read_excel(file_path)
369
+
370
  try:
 
 
 
 
 
 
371
  # Process the DataFrame
372
  console_messages.append("Processing the DataFrame...")
373
  result_df, console_messages = nlp_pipeline(df, console_messages)