Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -142,7 +142,7 @@ tab1, tab2, tab3 = st.tabs(["News Classification", "Ask Questions", "Advanced Fe
|
|
| 142 |
|
| 143 |
with tab1:
|
| 144 |
st.markdown('<div class="card">', unsafe_allow_html=True)
|
| 145 |
-
st.header("News Classification
|
| 146 |
st.write("Upload a CSV file containing news excerpts to classify them into categories.")
|
| 147 |
|
| 148 |
# File uploader with a descriptive message
|
|
@@ -274,23 +274,10 @@ with tab3:
|
|
| 274 |
st.header("Advanced Features")
|
| 275 |
st.write("Explore additional functionalities to enhance your news analysis.")
|
| 276 |
|
| 277 |
-
# Sentiment Analysis
|
| 278 |
-
st.subheader("📊 Sentiment Analysis")
|
| 279 |
-
sentiment_text = st.text_area("Enter text for sentiment analysis:", height=100)
|
| 280 |
-
if st.button("Analyze Sentiment"):
|
| 281 |
-
with st.spinner("Analyzing sentiment..."):
|
| 282 |
-
sentiment_pipeline = pipeline("sentiment-analysis")
|
| 283 |
-
result = sentiment_pipeline(sentiment_text)[0]
|
| 284 |
-
st.write(f"Label: {result['label']}")
|
| 285 |
-
st.write(f"Confidence: {result['score']:.2f}")
|
| 286 |
-
if result['label'] == 'POSITIVE':
|
| 287 |
-
st.success("This text appears positive!")
|
| 288 |
-
else:
|
| 289 |
-
st.warning("This text appears negative.")
|
| 290 |
|
| 291 |
# Named Entity Recognition
|
| 292 |
-
st.subheader("
|
| 293 |
-
ner_text = st.text_area("Enter
|
| 294 |
if st.button("Extract Entities"):
|
| 295 |
with st.spinner("Identifying entities..."):
|
| 296 |
ner_pipeline = pipeline("ner", grouped_entities=True)
|
|
@@ -305,14 +292,29 @@ with tab3:
|
|
| 305 |
st.table(pd.DataFrame(entities))
|
| 306 |
|
| 307 |
# Text Summarization
|
| 308 |
-
st.subheader("
|
| 309 |
-
summary_text = st.text_area("Enter
|
| 310 |
if st.button("Generate Summary"):
|
| 311 |
with st.spinner("Generating summary..."):
|
| 312 |
summarizer = pipeline("summarization")
|
| 313 |
summary = summarizer(summary_text, max_length=130, min_length=30)
|
| 314 |
st.write(summary[0]['summary_text'])
|
| 315 |
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
|
| 317 |
# Enhanced Sidebar with branding and instructions
|
| 318 |
with st.sidebar:
|
|
|
|
| 142 |
|
| 143 |
with tab1:
|
| 144 |
st.markdown('<div class="card">', unsafe_allow_html=True)
|
| 145 |
+
st.header("News Classification ")
|
| 146 |
st.write("Upload a CSV file containing news excerpts to classify them into categories.")
|
| 147 |
|
| 148 |
# File uploader with a descriptive message
|
|
|
|
| 274 |
st.header("Advanced Features")
|
| 275 |
st.write("Explore additional functionalities to enhance your news analysis.")
|
| 276 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
|
| 278 |
# Named Entity Recognition
|
| 279 |
+
st.subheader("Named Entity Recognition Of News Content")
|
| 280 |
+
ner_text = st.text_area("Enter News Content for entity recognition:", height=100)
|
| 281 |
if st.button("Extract Entities"):
|
| 282 |
with st.spinner("Identifying entities..."):
|
| 283 |
ner_pipeline = pipeline("ner", grouped_entities=True)
|
|
|
|
| 292 |
st.table(pd.DataFrame(entities))
|
| 293 |
|
| 294 |
# Text Summarization
|
| 295 |
+
st.subheader("News Content Summarization")
|
| 296 |
+
summary_text = st.text_area("Enter news content to summarize:", height=150)
|
| 297 |
if st.button("Generate Summary"):
|
| 298 |
with st.spinner("Generating summary..."):
|
| 299 |
summarizer = pipeline("summarization")
|
| 300 |
summary = summarizer(summary_text, max_length=130, min_length=30)
|
| 301 |
st.write(summary[0]['summary_text'])
|
| 302 |
st.markdown('</div>', unsafe_allow_html=True)
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
# Sentiment Analysis
|
| 306 |
+
st.subheader("News Tone Detector")
|
| 307 |
+
sentiment_text = st.text_area("Enter text for news content analysis:", height=100)
|
| 308 |
+
if st.button("Analyze Sentiment"):
|
| 309 |
+
with st.spinner("Analyzing sentiment..."):
|
| 310 |
+
sentiment_pipeline = pipeline("sentiment-analysis")
|
| 311 |
+
result = sentiment_pipeline(sentiment_text)[0]
|
| 312 |
+
st.write(f"Label: {result['label']}")
|
| 313 |
+
st.write(f"Confidence: {result['score']:.2f}")
|
| 314 |
+
if result['label'] == 'POSITIVE':
|
| 315 |
+
st.success("This text appears positive!")
|
| 316 |
+
else:
|
| 317 |
+
st.warning("This text appears negative.")
|
| 318 |
|
| 319 |
# Enhanced Sidebar with branding and instructions
|
| 320 |
with st.sidebar:
|