Spaces:
Configuration error
Configuration error
import streamlit as st | |
import pandas as pd | |
from excel_parser import parse_excel | |
from query_agent import ask_question | |
from utils import export_to_csv, export_to_pdf | |
st.set_page_config(page_title="SheetMate π", layout="wide") | |
st.title("π€ SheetMate β Chat with your Excel") | |
uploaded_file = st.file_uploader("π Upload an Excel file", type=["xlsx", "xls"]) | |
if uploaded_file: | |
dfs = parse_excel(uploaded_file) | |
sheet = st.selectbox("ποΈ Select a sheet", list(dfs.keys())) | |
df = dfs[sheet] | |
st.dataframe(df, use_container_width=True) | |
col1, col2 = st.columns(2) | |
with col1: | |
if st.button("β¬οΈ Export to CSV"): | |
csv = export_to_csv(df) | |
st.download_button("Download CSV", csv, "sheetmate_data.csv", "text/csv") | |
with col2: | |
if st.button("π§Ύ Export to PDF"): | |
pdf_bytes = export_to_pdf(df) | |
st.download_button("Download PDF", pdf_bytes, "sheetmate_data.pdf", "application/pdf") | |
user_query = st.text_input("π¬ Ask a question about your data") | |
if user_query: | |
with st.spinner("π€ Thinking..."): | |
answer = ask_question(user_query, df) | |
st.success(answer) | |
st.markdown("---") | |
st.markdown("π οΈ Developed by **Akash Shahade**", unsafe_allow_html=True) |