Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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
|
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 = ['
|
83 |
if not all(col in custom_df.columns for col in required_columns):
|
84 |
-
return f"Error: Uploaded CSV must contain the following
|
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:
|