Spaces:
Build error
Build error
Update app.py
Browse files1234567891011121314151617181920212223242526272829import streamlit as stimport pandas as pdfrom tariff_scraper import TARIFF_URLS, scrape_multiple_sections_to_csvdef main():st.title("PESCO Tariff Rates Viewer")st.write("This app fetches and displays the latest PESCO tariff rates.")# Button to fetch and save tariff ratesif st.button("Fetch and Save PESCO Tariff Rates"):url = TARIFF_URLS["PESCO"]st.write(f"Fetching data from {url}...")with st.spinner("Scraping data..."):output_file = scrape_multiple_sections_to_csv(url)if output_file.endswith(".csv"):st.success(f"Data successfully saved to {output_file}!")st.write("### Preview of Tariff Rates:")try:# Read the CSV file and display it in tabular formatdata = pd.read_csv(output_file)st.dataframe(data)except Exception as e:st.error(f"Error reading the CSV file: {e}")else:st.error(output_file)if __name__ == "__main__":main()123456789101112131415161718192021222324import streamlit as stfrom tariff_scraper import TARIFF_URLS, scrape_tariff_datadef main():st.title("IESCO Tariff Rates Viewer")st.write("This app fetches and displays the latest IESCO tariff rates.")# Display the fetch buttonif st.button("Fetch IESCO Tariff Rates"):url = TARIFF_URLS["IESCO"]st.write(f"Fetching data from {url}...")with st.spinner("Scraping data..."):data = scrape_tariff_data(url)if data and isinstance(data, list) and len(data) > 0:st.success("Data fetched successfully!")st.write("### Tariff Rates:")for row in data:st.write(row)else:st.error("Failed to fetch tariff data or no data found.")if __name__ == "__main__":main()
app.py+13-18