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")