Update app.py
Browse files
app.py
CHANGED
@@ -674,23 +674,24 @@ def create_interface():
|
|
674 |
"""축원 완료 및 분석 처리"""
|
675 |
if audio is None:
|
676 |
return (
|
677 |
-
state,
|
678 |
-
"음성을 먼저 녹음해주세요.",
|
679 |
-
|
680 |
-
gr.update(visible=True),
|
681 |
-
gr.update(visible=False)
|
682 |
)
|
|
|
683 |
try:
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
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,
|
713 |
-
"축원이 완료되었습니다.",
|
714 |
-
|
715 |
-
gr.update(visible=False),
|
716 |
-
gr.update(visible=True)
|
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 |
)
|
|
|
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 |
)
|