cyberandy commited on
Commit
7709365
1 Parent(s): 4843ba8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -139,13 +139,14 @@ def main():
139
  # User input
140
  user_query = st.text_area("Enter your query:", height=150)
141
  submit_button = st.button("Analyze Query")
 
142
  # Create tabs
143
  tab1, tab2, tab3 = st.tabs(["Overview", "Analysis", "Sentiment"])
144
 
145
  # Tab 1: Overview - Showing the initial response and sources
146
  with tab1:
147
- user_query = st.text_area("Enter your query:", height=150)
148
- submit_button = st.button("Analyze Query")
149
 
150
  if submit_button and user_query:
151
  response = fetch_response(user_query)
@@ -157,8 +158,9 @@ def main():
157
 
158
  # Tab 2: Analysis - Showing the result of the advanced analysis
159
  with tab2:
160
- if submit_button and user_query:
161
- advanced_response = fetch_advanced_analysis(user_query, msg)
 
162
  advanced_msg = advanced_response.get('message', 'No advanced analysis available.')
163
  analysis_data = parse_analysis(advanced_msg)
164
 
@@ -174,7 +176,7 @@ def main():
174
 
175
  # Tab 3: Sentiment - Displaying sentiment analysis of the response
176
  with tab3:
177
- if submit_button and user_query:
178
  df_sentiment = sentiment_analysis(msg)
179
  fig = px.scatter(df_sentiment, y='dominant_sentiment', color='dominant_sentiment', size='confidence',
180
  hover_data=['content'],
 
139
  # User input
140
  user_query = st.text_area("Enter your query:", height=150)
141
  submit_button = st.button("Analyze Query")
142
+
143
  # Create tabs
144
  tab1, tab2, tab3 = st.tabs(["Overview", "Analysis", "Sentiment"])
145
 
146
  # Tab 1: Overview - Showing the initial response and sources
147
  with tab1:
148
+ user_query = st.text_area("Enter your query:", height=150, key="query_overview")
149
+ submit_button = st.button("Analyze Query", key="submit_overview")
150
 
151
  if submit_button and user_query:
152
  response = fetch_response(user_query)
 
158
 
159
  # Tab 2: Analysis - Showing the result of the advanced analysis
160
  with tab2:
161
+ # In case you need inputs here as well, ensure they have unique keys
162
+ if 'submit_overview' in st.session_state and st.session_state.submit_overview:
163
+ advanced_response = fetch_advanced_analysis(st.session_state.query_overview, msg)
164
  advanced_msg = advanced_response.get('message', 'No advanced analysis available.')
165
  analysis_data = parse_analysis(advanced_msg)
166
 
 
176
 
177
  # Tab 3: Sentiment - Displaying sentiment analysis of the response
178
  with tab3:
179
+ if 'submit_overview' in st.session_state and st.session_state.submit_overview:
180
  df_sentiment = sentiment_analysis(msg)
181
  fig = px.scatter(df_sentiment, y='dominant_sentiment', color='dominant_sentiment', size='confidence',
182
  hover_data=['content'],