ZennyKenny commited on
Commit
3b076ac
Β·
verified Β·
1 Parent(s): d5f54da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -36,7 +36,7 @@ def classify_comments(categories):
36
  sentiments.append(sentiment)
37
  df['comment_sentiment'] = sentiments
38
  df['comment_category'] = assigned_categories
39
- return df[['customer_id', 'customer_comment', 'comment_sentiment', 'comment_category', 'customer_nps', 'customer_segment']].to_html(index=False)
40
 
41
  # Gradio Interface
42
  with gr.Blocks() as nps:
@@ -79,9 +79,9 @@ with gr.Blocks() as nps:
79
  else:
80
  return "Error: Uploaded file is not a CSV."
81
  # Check for required columns
82
- required_columns = ['customer_id', 'customer_comment', 'customer_nps', 'customer_segment']
83
  if not all(col in custom_df.columns for col in required_columns):
84
- return f"Error: Uploaded CSV must contain the following columns: {', '.join(required_columns)}"
85
  df = custom_df
86
  return "Custom CSV loaded successfully!"
87
  else:
 
36
  sentiments.append(sentiment)
37
  df['comment_sentiment'] = sentiments
38
  df['comment_category'] = assigned_categories
39
+ return df.to_html(index=False) # Return all fields with appended sentiment and category
40
 
41
  # Gradio Interface
42
  with gr.Blocks() as nps:
 
79
  else:
80
  return "Error: Uploaded file is not a CSV."
81
  # Check for required columns
82
+ required_columns = ['customer_comment']
83
  if not all(col in custom_df.columns for col in required_columns):
84
+ return f"Error: Uploaded CSV must contain the following column: {', '.join(required_columns)}"
85
  df = custom_df
86
  return "Custom CSV loaded successfully!"
87
  else: