Ginidu2003 commited on
Commit
e1c09c6
·
verified ·
1 Parent(s): 695c11e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
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
- return f"✅ Success! Classified {len(df)} rows", output_file, category_counts
 
 
 
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
- x="Category",
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