haepada commited on
Commit
90b1cf1
·
verified ·
1 Parent(s): 62bb92a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -674,23 +674,24 @@ def create_interface():
674
  """축원 완료 및 분석 처리"""
675
  if audio is None:
676
  return (
677
- state,
678
- "음성을 먼저 녹음해주세요.",
679
- gr.update(visible=False), # analysis_result
680
- gr.update(visible=True), # blessing_section
681
- gr.update(visible=False), # entry_guide_section
682
  )
 
683
  try:
684
- features = calculate_baseline_features(audio)
685
- if features is None:
686
- return (
687
- state,
688
- "음성 분석에 실패했습니다. 다시 시도해주세요.",
689
- gr.update(visible=False),
690
- gr.update(visible=True),
691
- gr.update(visible=False)
692
- )
693
-
694
  # 감정 분석
695
  baseline_emotion = map_acoustic_to_emotion(features)
696
 
@@ -707,20 +708,19 @@ def create_interface():
707
  # 상태 업데이트
708
  new_state = {**state, "baseline_features": features, "analysis_complete": True}
709
 
710
- # 분석이 완료되면 다음 단계로 진행 (모든 출력값 포함)
711
  return (
712
- new_state, # state
713
- "축원이 완료되었습니다.", # status message
714
- gr.update(value=analysis_text, visible=True), # analysis_result
715
- gr.update(visible=False), # blessing_section
716
- gr.update(visible=True) # entry_guide_section
717
  )
718
 
719
  except Exception as e:
720
  return (
721
  state,
722
  f"오류가 발생했습니다: {str(e)}",
723
- gr.update(visible=False),
724
  gr.update(visible=True),
725
  gr.update(visible=False)
726
  )
 
674
  """축원 완료 및 분석 처리"""
675
  if audio is None:
676
  return (
677
+ state, # state
678
+ "음성을 먼저 녹음해주세요.", # 첫 번째 markdown (status)
679
+ "", # 두 번째 markdown (result)
680
+ gr.update(visible=True), # blessing_section visibility
681
+ gr.update(visible=False) # entry_guide_section visibility
682
  )
683
+
684
  try:
685
+ features = calculate_baseline_features(audio)
686
+ if features is None:
687
+ return (
688
+ state,
689
+ "음성 분석에 실패했습니다.",
690
+ "",
691
+ gr.update(visible=True),
692
+ gr.update(visible=False)
693
+ )
694
+
695
  # 감정 분석
696
  baseline_emotion = map_acoustic_to_emotion(features)
697
 
 
708
  # 상태 업데이트
709
  new_state = {**state, "baseline_features": features, "analysis_complete": True}
710
 
 
711
  return (
712
+ new_state, # state
713
+ "축원이 완료되었습니다.", # 첫 번째 markdown (status)
714
+ analysis_text, # 두 번째 markdown (result)
715
+ gr.update(visible=False), # blessing_section visibility
716
+ gr.update(visible=True) # entry_guide_section visibility
717
  )
718
 
719
  except Exception as e:
720
  return (
721
  state,
722
  f"오류가 발생했습니다: {str(e)}",
723
+ "",
724
  gr.update(visible=True),
725
  gr.update(visible=False)
726
  )