Spaces:
Running
Running
Commit
·
cbf5d86
1
Parent(s):
a724e97
Change bar plot x-axis from counts to percentages (0-100 scale)
Browse files- Display percentage values instead of raw counts
- Set x-axis limits to 0-100 for consistent scale
- Update title to "Category Distribution (%)"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- __pycache__/app.cpython-311.pyc +0 -0
- app.py +6 -4
__pycache__/app.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
|
app.py
CHANGED
|
@@ -556,16 +556,17 @@ is the key and a 1 if the category is present and a 0 if not.'''
|
|
| 556 |
python_version=python_version
|
| 557 |
)
|
| 558 |
|
| 559 |
-
# Build distribution summary DataFrame for bar plot
|
| 560 |
dist_data = []
|
| 561 |
total_rows = len(result)
|
| 562 |
for i, cat in enumerate(categories, 1):
|
| 563 |
col_name = f"category_{i}"
|
| 564 |
if col_name in result.columns:
|
| 565 |
count = int(result[col_name].sum())
|
|
|
|
| 566 |
dist_data.append({
|
| 567 |
"Category": cat,
|
| 568 |
-
"
|
| 569 |
})
|
| 570 |
distribution_df = pd.DataFrame(dist_data)
|
| 571 |
|
|
@@ -792,10 +793,11 @@ https://github.com/chrissoria/cat-llm
|
|
| 792 |
with gr.Column():
|
| 793 |
status = gr.Markdown("Ready to classify")
|
| 794 |
distribution_plot = gr.BarPlot(
|
| 795 |
-
x="
|
| 796 |
y="Category",
|
| 797 |
-
title="Category Distribution",
|
| 798 |
horizontal=True,
|
|
|
|
| 799 |
visible=False
|
| 800 |
)
|
| 801 |
sample_results = gr.DataFrame(label="Sample Results (First 5 Rows)", visible=False)
|
|
|
|
| 556 |
python_version=python_version
|
| 557 |
)
|
| 558 |
|
| 559 |
+
# Build distribution summary DataFrame for bar plot (percentages)
|
| 560 |
dist_data = []
|
| 561 |
total_rows = len(result)
|
| 562 |
for i, cat in enumerate(categories, 1):
|
| 563 |
col_name = f"category_{i}"
|
| 564 |
if col_name in result.columns:
|
| 565 |
count = int(result[col_name].sum())
|
| 566 |
+
pct = (count / total_rows) * 100 if total_rows > 0 else 0
|
| 567 |
dist_data.append({
|
| 568 |
"Category": cat,
|
| 569 |
+
"Percentage": round(pct, 1)
|
| 570 |
})
|
| 571 |
distribution_df = pd.DataFrame(dist_data)
|
| 572 |
|
|
|
|
| 793 |
with gr.Column():
|
| 794 |
status = gr.Markdown("Ready to classify")
|
| 795 |
distribution_plot = gr.BarPlot(
|
| 796 |
+
x="Percentage",
|
| 797 |
y="Category",
|
| 798 |
+
title="Category Distribution (%)",
|
| 799 |
horizontal=True,
|
| 800 |
+
x_lim=[0, 100],
|
| 801 |
visible=False
|
| 802 |
)
|
| 803 |
sample_results = gr.DataFrame(label="Sample Results (First 5 Rows)", visible=False)
|