Spaces:
Sleeping
Sleeping
File size: 2,313 Bytes
712d86b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
import pandas as pd
import streamlit as st
from Scrapper_Summarizer import scrape_dawn, scrape_brecorder, scrape_tnews
def load_articles_in_batches(articles, batch_size, offset):
return articles[offset:offset + batch_size]
def News_scrapper():
# App title and description
st.title("📰 Business News Scrapper & Summarizer")
st.write("This app scrapes the latest business news from *Dawn* and *Business Recorder* and summarizes the articles for easy reading.")
# Add a sidebar for navigation
st.sidebar.write("Use this sidebar to navigate between options.")
st.sidebar.markdown("### Scraping Options")
# Add a button for Dawn News scraping
if st.sidebar.button('Scrape Dawn News'):
st.subheader("Latest Business News from Dawn")
with st.spinner("Scraping and summarizing news from Dawn..."):
dawn_articles = scrape_dawn()
if dawn_articles:
df = pd.DataFrame(dawn_articles)
st.dataframe(df)
else:
st.write("No articles found.")
# Add a button for Business Recorder scraping
if st.sidebar.button('Scrape Business Recorder'):
st.subheader("Latest Business News from Business Recorder")
with st.spinner("Scraping and summarizing news from Business Recorder..."):
brecorder_articles = scrape_brecorder()
if brecorder_articles:
df = pd.DataFrame(brecorder_articles)
st.dataframe(df)
else:
st.write("No articles found.")
# Add a button for The News scraping
if st.sidebar.button('Scrape The News'):
st.subheader("Latest Business News from The News")
with st.spinner("Scraping and summarizing news from The News..."):
tnews_articles = scrape_tnews()
if tnews_articles:
df = pd.DataFrame(tnews_articles)
st.dataframe(df)
else:
st.write("No articles found.")
# Sidebar details and beautification
st.sidebar.markdown("---")
st.sidebar.info("This utility scrapes the latest business articles and generates summaries using the BART summarization model. Great for quick reads!")
st.sidebar.markdown("---")
st.sidebar.write("Created by Strategy")
|