Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -215,14 +215,6 @@ with tab1:
|
|
| 215 |
|
| 216 |
# Classify each article and store predictions
|
| 217 |
df["Class"] = df["preprocessed_content"].apply(lambda text: classifier(text)[0]["label"])
|
| 218 |
-
|
| 219 |
-
# Keep only necessary columns
|
| 220 |
-
df = df[['content','Class']]
|
| 221 |
-
df1=df[['content']]
|
| 222 |
-
|
| 223 |
-
#show Classification Results
|
| 224 |
-
st.subheader("Classification Results")
|
| 225 |
-
st.write(df)
|
| 226 |
|
| 227 |
# Word Cloud Visualization
|
| 228 |
def create_wordcloud(text_data):
|
|
@@ -234,7 +226,16 @@ with tab1:
|
|
| 234 |
st.pyplot(plt)
|
| 235 |
|
| 236 |
st.subheader("Word Cloud of News Content")
|
| 237 |
-
create_wordcloud(df['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
|
| 239 |
#show class distribution
|
| 240 |
st.subheader("Class Distribution")
|
|
@@ -285,7 +286,7 @@ with tab2:
|
|
| 285 |
#generate the answer based on selected news content using the given model
|
| 286 |
st.markdown("---")
|
| 287 |
st.header("Ask Questions Based on Your News Content")
|
| 288 |
-
context_1 = st.selectbox("Choose an article for the question:",
|
| 289 |
|
| 290 |
question_1 = st.text_input("Enter your question:", key="question_input")
|
| 291 |
if st.button("Get Answer", key="get_answer_1"):
|
|
|
|
| 215 |
|
| 216 |
# Classify each article and store predictions
|
| 217 |
df["Class"] = df["preprocessed_content"].apply(lambda text: classifier(text)[0]["label"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
# Word Cloud Visualization
|
| 220 |
def create_wordcloud(text_data):
|
|
|
|
| 226 |
st.pyplot(plt)
|
| 227 |
|
| 228 |
st.subheader("Word Cloud of News Content")
|
| 229 |
+
create_wordcloud(df['preprocessed_content'])
|
| 230 |
+
|
| 231 |
+
# Keep only necessary columns
|
| 232 |
+
df = df[['content','Class']]
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
#show Classification Results
|
| 236 |
+
st.subheader("Classification Results")
|
| 237 |
+
st.write(df)
|
| 238 |
+
|
| 239 |
|
| 240 |
#show class distribution
|
| 241 |
st.subheader("Class Distribution")
|
|
|
|
| 286 |
#generate the answer based on selected news content using the given model
|
| 287 |
st.markdown("---")
|
| 288 |
st.header("Ask Questions Based on Your News Content")
|
| 289 |
+
context_1 = st.selectbox("Choose an article for the question:", df['content'].tolist())
|
| 290 |
|
| 291 |
question_1 = st.text_input("Enter your question:", key="question_input")
|
| 292 |
if st.button("Get Answer", key="get_answer_1"):
|