Update app.py
Browse files41 unmodified lines424344454546474851 unmodified lines10010110210310410510681 unmodified lines188189190191192193194195196197198199200201202203255 unmodified lines45946046146246346446546646746846947047147247347447547647747847988 unmodified lines56856957057157257354757457557657757857919 unmodified lines59960060160260360460560660760860941 unmodified lines st.success(openai_status)else: st.error(openai_status) st.info("HuggingFace is installing dependencies... Refresh page in 30 seconds.") st.info("Installing dependencies... Refresh page in 30 seconds.") st.stop()
if not modules_loaded:51 unmodified lines # Queue dla komunikacji między wątkami self.status_queue = queue.Queue() self.processing_thread = None self.processing_completed = False def initialize_session_state(self): """Inicjalizacja session state"""81 unmodified lines if hasattr(self, 'local_final_report'): st.session_state.final_report = self.local_final_report st.session_state.processing_status = 'completed' st.session_state.overall_progress = 1.0 st.session_state.current_file_progress = "✅ Zakończono!" delattr(self, 'local_final_report') # Sprawdź flagę zakończenia if hasattr(self, 'processing_completed') and self.processing_completed: st.session_state.processing_status = 'completed' st.session_state.overall_progress = 1.0 st.session_state.current_file_progress = "✅ Zakończono!" self.processing_completed = False except Exception as e: print(f"SYNC ERROR: {e}")255 unmodified lines # Auto-refresh podczas przetwarzania if st.session_state.processing_status == 'running': # Sprawdź czy wątek się zakończył if hasattr(self, 'processing_thread') and not self.processing_thread.is_alive(): # Wątek się zakończył - sprawdź czy mamy raport if hasattr(self, 'local_final_report'): st.session_state.final_report = self.local_final_report st.session_state.processing_status = 'completed' st.session_state.overall_progress = 1.0 st.session_state.current_file_progress = "✅ Zakończono!" delattr(self, 'local_final_report') st.rerun() elif len(st.session_state.transcriptions) > 0: # Mamy transkrypcje ale brak raportu - możliwy błąd st.session_state.processing_status = 'error' st.rerun() time.sleep(2) st.rerun() 88 unmodified lines try: st.session_state.final_report = final_report st.session_state.processing_status = 'completed' st.session_state.overall_progress = 1.0 st.session_state.current_file_progress = "✅ Zakończono!" except: # Fallback - zapisz lokalnie # Fallback - zapisz lokalnie i oznacz flagę self.local_final_report = final_report self.processing_completed = True print("REPORT: Generated and saved locally") self.update_progress_safe(1.0, "✅ Zakończono!")19 unmodified lines st.session_state.processing_status = 'error' except: print(f"CRITICAL ERROR: {e}") finally: # Oznacz zakończenie przetwarzania self.processing_completed = True print("THREAD: Processing completed - setting flag") def render_results(self): """Renderuj wyniki"""app.py+35-2