Prageeth-1 commited on
Commit
ddc56ef
·
verified ·
1 Parent(s): 1a618af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -107,13 +107,7 @@ with tab1:
107
 
108
  # Load the CSV file
109
 
110
- df = pd.read_csv(uploaded_file)
111
 
112
- # Load the fine-tuned news classifier
113
- classifier = pipeline("text-classification", model="Prageeth-1/News_classification.2")
114
-
115
- # Classify each article and store the predictions
116
- df["predicted_category"] = df["content"].apply(lambda text: classifier(text)[0]["label"])
117
 
118
 
119
 
@@ -123,10 +117,13 @@ with tab1:
123
 
124
 
125
  else:
126
- # Show preview
127
- st.subheader("File Preview")
128
- st.write(df.head())
129
-
 
 
 
130
 
131
  # Preprocess and classify
132
 
@@ -137,12 +134,12 @@ with tab1:
137
 
138
  # Show distribution
139
  st.subheader("Class Distribution")
140
- class_dist = df['class'].value_counts()
141
  st.bar_chart(class_dist)
142
 
143
  # Generate word cloud for each class
144
  st.subheader("Word Clouds by Category")
145
- classes = df['class'].unique()
146
  cols = st.columns(len(classes))
147
 
148
 
 
107
 
108
  # Load the CSV file
109
 
 
110
 
 
 
 
 
 
111
 
112
 
113
 
 
117
 
118
 
119
  else:
120
+ df = pd.read_csv(uploaded_file)
121
+
122
+ # Load the fine-tuned news classifier
123
+ classifier = pipeline("text-classification", model="Prageeth-1/News_classification.2")
124
+
125
+ # Classify each article and store the predictions
126
+ df["predicted_category"] = df["content"].apply(lambda text: classifier(text)[0]["label"])
127
 
128
  # Preprocess and classify
129
 
 
134
 
135
  # Show distribution
136
  st.subheader("Class Distribution")
137
+ class_dist = df['predicted_category'].value_counts()
138
  st.bar_chart(class_dist)
139
 
140
  # Generate word cloud for each class
141
  st.subheader("Word Clouds by Category")
142
+ classes = df['predicted_category'].unique()
143
  cols = st.columns(len(classes))
144
 
145