soojeongcrystal commited on
Commit
e022016
·
verified ·
1 Parent(s): 9e2c796

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -336,22 +336,20 @@ if 'run_analysis' in st.session_state and st.session_state.run_analysis:
336
  if api_key:
337
  st.header("토픽 종합 해석")
338
 
339
- if 'topic_interpretation' not in st.session_state:
340
- st.session_state.topic_interpretation = None
341
-
342
  col1, col2 = st.columns([3, 1])
343
  with col2:
344
  if st.button("토픽 다시 해석하기", key="reinterpret"):
345
  st.session_state.topic_interpretation = None
346
-
347
- if st.session_state.topic_interpretation is None:
348
- with st.spinner("토픽 해석 중..."):
349
- st.session_state.topic_interpretation = interpret_topics(api_key, topic_results)
350
 
351
  with col1:
 
 
 
 
352
  st.subheader("토픽 모델링 종합 결과")
353
  st.text_area("결과를 복사하여 사용하세요:", value=st.session_state.topic_interpretation, height=500)
354
-
355
  st.subheader("토픽 요약 테이블")
356
  topic_summary_df = pd.DataFrame([
357
  {
@@ -362,7 +360,7 @@ if 'run_analysis' in st.session_state and st.session_state.run_analysis:
362
  } for info in topic_results
363
  ])
364
  st.table(topic_summary_df)
365
-
366
  else:
367
  st.warning("Claude API 키가 설정되지 않았습니다. https://console.anthropic.com/settings/keys 에 접속하여 API 키를 발급받으시면 토픽명과 해석을 제공받으실 수 있습니다.")
368
  except Exception as e:
 
336
  if api_key:
337
  st.header("토픽 종합 해석")
338
 
 
 
 
339
  col1, col2 = st.columns([3, 1])
340
  with col2:
341
  if st.button("토픽 다시 해석하기", key="reinterpret"):
342
  st.session_state.topic_interpretation = None
343
+ st.experimental_rerun()
 
 
 
344
 
345
  with col1:
346
+ if 'topic_interpretation' not in st.session_state or st.session_state.topic_interpretation is None:
347
+ with st.spinner("토픽 해석 중..."):
348
+ st.session_state.topic_interpretation = interpret_topics(api_key, topic_results)
349
+
350
  st.subheader("토픽 모델링 종합 결과")
351
  st.text_area("결과를 복사하여 사용하세요:", value=st.session_state.topic_interpretation, height=500)
352
+
353
  st.subheader("토픽 요약 테이블")
354
  topic_summary_df = pd.DataFrame([
355
  {
 
360
  } for info in topic_results
361
  ])
362
  st.table(topic_summary_df)
363
+
364
  else:
365
  st.warning("Claude API 키가 설정되지 않았습니다. https://console.anthropic.com/settings/keys 에 접속하여 API 키를 발급받으시면 토픽명과 해석을 제공받으실 수 있습니다.")
366
  except Exception as e: