Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,7 +65,10 @@ def classify_csv(file):
|
|
| 65 |
category_counts = df['class'].value_counts().reset_index()
|
| 66 |
category_counts.columns = ["Category", "Count"]
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
except Exception as e:
|
| 70 |
return f"❌ Error: {str(e)}", None, None
|
| 71 |
|
|
@@ -143,9 +146,8 @@ with gr.Blocks(title=" News Classifier & Question Answering App") as demo:
|
|
| 143 |
output_text = gr.Textbox(label="Status")
|
| 144 |
output_file = gr.File(label="Download output.csv")
|
| 145 |
bar_chart = gr.Plot(
|
| 146 |
-
label="Category Distribution Across 5 Classes"
|
| 147 |
-
|
| 148 |
-
y="Count",
|
| 149 |
|
| 150 |
)
|
| 151 |
|
|
|
|
| 65 |
category_counts = df['class'].value_counts().reset_index()
|
| 66 |
category_counts.columns = ["Category", "Count"]
|
| 67 |
|
| 68 |
+
# Create colored bar chart
|
| 69 |
+
fig = create_colored_bar_chart(category_counts)
|
| 70 |
+
|
| 71 |
+
return f"✅ Success! Classified {len(df)} rows", output_file, fig
|
| 72 |
except Exception as e:
|
| 73 |
return f"❌ Error: {str(e)}", None, None
|
| 74 |
|
|
|
|
| 146 |
output_text = gr.Textbox(label="Status")
|
| 147 |
output_file = gr.File(label="Download output.csv")
|
| 148 |
bar_chart = gr.Plot(
|
| 149 |
+
label="Category Distribution Across 5 Classes"
|
| 150 |
+
|
|
|
|
| 151 |
|
| 152 |
)
|
| 153 |
|