Update app.py
Browse files388 unmodified lines38939039139239339439539639739849 unmodified lines44844945045145245345445545645745845946046146246346446546646746846947047159 unmodified lines531532533534535536537538539540541542543544545388 unmodified linesst.session_state.current_file_progress = ""st.session_state.overall_progress = 0# Uruchom przetwarzanie w osobnym w膮tkuself.processing_thread = threading.Thread(target=self.process_files_async,args=(settings,))self.processing_thread.start()st.rerun()49 unmodified linestime.sleep(2)st.rerun()def process_files_async(self, settings):"""Asynchroniczne przetwarzanie plik贸w - thread-safe"""try:self.log_message("馃殌 Rozpoczynam przetwarzanie plik贸w", force_local=True)total_files = len(st.session_state.uploaded_files)# ETAP 1: Transkrypcja plik贸wfor i, file_info in enumerate(st.session_state.uploaded_files):# Sprawd藕 status w bezpieczny spos贸btry:if st.session_state.processing_status != 'running':self.log_message("鈴癸笍 Przetwarzanie zatrzymane przez u偶ytkownika", force_local=True)returnexcept:# Je艣li nie mo偶na sprawdzi膰 statusu, zako艅czprint("Cannot access session_state status - stopping")returntry:# Update progress59 unmodified linesself.update_progress_safe(0.9, "馃搫 Generuj臋 raport badawczy...")self.log_message("馃搫 Rozpoczynam generowanie raportu", force_local=True)# Pobierz brief z session_statetry:brief = st.session_state.research_briefexcept:brief = ""final_report = self.report_generator.generate_comprehensive_report(transcriptions_to_use,brief)# Zapisz raport388 unmodified lines38939039139239339439539639739839940040140249 unmodified lines45245345445545645745845946046146246346446546646746846947047147247347459 unmodified lines534535536537538539540541542388 unmodified linesst.session_state.current_file_progress = ""st.session_state.overall_progress = 0# Przeka偶 dane do w膮tku (kopiuj dane z session_state)files_copy = st.session_state.uploaded_files.copy()brief_copy = st.session_state.research_brief# Uruchom przetwarzanie w osobnym w膮tkuself.processing_thread = threading.Thread(target=self.process_files_async,args=(settings, files_copy, brief_copy))self.processing_thread.start()st.rerun()49 unmodified linestime.sleep(2)st.rerun()def process_files_async(self, settings, uploaded_files, research_brief):"""Asynchroniczne przetwarzanie plik贸w - thread-safe z przekazanymi danymi"""try:self.log_message("馃殌 Rozpoczynam przetwarzanie plik贸w", force_local=True)total_files = len(uploaded_files)# ETAP 1: Transkrypcja plik贸wfor i, file_info in enumerate(uploaded_files):# Sprawd藕 status w bezpieczny spos贸btry:if st.session_state.processing_status != 'running':self.log_message("鈴癸笍 Przetwarzanie zatrzymane przez u偶ytkownika", force_local=True)returnexcept:# Je艣li nie mo偶na sprawdzi膰 statusu, kontynuuj (mo偶e by膰 w middle of processing)passtry:# Update progress59 unmodified linesself.update_progress_safe(0.9, "馃搫 Generuj臋 raport badawczy...")self.log_message("馃搫 Rozpoczynam generowanie raportu", force_local=True)final_report = self.report_generator.generate_comprehensive_report(transcriptions_to_use,research_brief)# Zapisz raport
app.py+12-15