wekey1998 commited on
Commit
926ab7a
Β·
verified Β·
1 Parent(s): 61f0795

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -60,6 +60,16 @@ if 'results' not in st.session_state:
60
  if 'analysis_complete' not in st.session_state:
61
  st.session_state.analysis_complete = False
62
 
 
 
 
 
 
 
 
 
 
 
63
  def main():
64
  # Header
65
  st.markdown('<h1 class="main-header">🌐 Global Business News Intelligence Dashboard</h1>', unsafe_allow_html=True)
@@ -100,6 +110,10 @@ def main():
100
  try:
101
  # Create progress bar
102
  progress_bar = st.progress(0)
 
 
 
 
103
  status_text = st.empty()
104
 
105
  # Run analysis
@@ -138,8 +152,16 @@ def main():
138
 
139
  def update_progress(progress, status):
140
  """Callback function for progress updates"""
141
- # This would be called from the analyzer
142
- pass
 
 
 
 
 
 
 
 
143
 
144
  def display_results(results):
145
  """Display analysis results with interactive dashboard"""
 
60
  if 'analysis_complete' not in st.session_state:
61
  st.session_state.analysis_complete = False
62
 
63
+ # Ensure extra session keys exist
64
+ if 'query' not in st.session_state:
65
+ st.session_state.query = ''
66
+ if 'progress' not in st.session_state:
67
+ st.session_state.progress = 0
68
+ if 'progress_bar' not in st.session_state:
69
+ st.session_state.progress_bar = None
70
+ if 'status_text' not in st.session_state:
71
+ st.session_state.status_text = None
72
+
73
  def main():
74
  # Header
75
  st.markdown('<h1 class="main-header">🌐 Global Business News Intelligence Dashboard</h1>', unsafe_allow_html=True)
 
110
  try:
111
  # Create progress bar
112
  progress_bar = st.progress(0)
113
+ # Store UI handles in session state for callbacks
114
+ st.session_state.progress_bar = progress_bar
115
+ st.session_state.status_text = status_text
116
+
117
  status_text = st.empty()
118
 
119
  # Run analysis
 
152
 
153
  def update_progress(progress, status):
154
  """Callback function for progress updates"""
155
+ try:
156
+ st.session_state.progress = progress
157
+ if st.session_state.progress_bar is not None:
158
+ st.session_state.progress_bar.progress(int(max(0, min(100, progress))))
159
+ if st.session_state.status_text is not None:
160
+ st.session_state.status_text.text(status)
161
+ except Exception:
162
+ pass
163
+
164
+
165
 
166
  def display_results(results):
167
  """Display analysis results with interactive dashboard"""