Adding stop functionality in streamlit app that should return me the same output as it returns on process completion

I am working on Cv seggregation app, using streamlit app.
It gets the files from user, process it and stores it to the specific directory, which is working fine on locally, but when I deployed it on streamlit, it stores the these processed files to the session storage of streamlit cloud, which is not directly accessible.

I added the download button, which will allow the user to download the processed files when the process is completed.

How can I add a stop button, that should allow the user to halt the process and provide the download button, so that the user should be able to download the files that is processed and stored in the streamlit storage?

Here is my code without the stopping functionality.

def main():
    st.title("Resume Analysis")

    uploaded_files = st.file_uploader("Upload CV files (PDF only)", type="pdf", accept_multiple_files=True)
    user_required_Skills = st.text_input("Enter the required skills (comma-separated):")
    user_required_experience_years = st.number_input("Enter the required experience (years):", min_value=0, value=0)
    user_required_experience_months = st.number_input("Enter the required experience (months):", min_value=0, value=0)
    output_dir = "filtered_cvs"

    if not os.path.exists(output_dir):
        os.makedirs(output_dir)
        
    # Create placeholders for buttons
    start_analysis_placeholder = st.empty()
    download_button_placeholder = st.empty()
    
    if start_analysis_placeholder.button("Start Analysis"):
        if uploaded_files:
            filtered_files = []
            for uploaded_file in uploaded_files:
                file_name = uploaded_file.name
                file_path = os.path.join(file_name)
                
                with open(file_path, "wb") as f:
                    f.write(uploaded_file.getbuffer())

                filtered_file_path = process_file(file_path, user_required_Skills, user_required_experience_years, user_required_experience_months, output_dir)
                
                if filtered_file_path:
                    filtered_files.append(filtered_file_path)
                
                os.remove(file_path)  # Clean up after processing
            
            if filtered_files:
                zip_file_path = os.path.join(output_dir, "filtered_cvs.zip")
                with zipfile.ZipFile(zip_file_path, 'w') as zipf:
                    for file in filtered_files:
                        zipf.write(file, os.path.basename(file))
                
                with open(zip_file_path, "rb") as f:
                    download_button_placeholder.download_button(
                        label="Download All Filtered CVs",
                        data=f,
                        file_name="filtered_cvs.zip",
                        mime="application/zip"
                    )
            else:
                st.error("No CVs met the required criteria.")
        else:
            st.error("Please upload at least one PDF file.")

if __name__ == "__main__":
    main()

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật