Update app.py
Browse files
app.py
CHANGED
@@ -673,24 +673,12 @@ def create_interface():
|
|
673 |
def handle_blessing_complete(audio, state):
|
674 |
"""축원 완료 및 분석 처리"""
|
675 |
if audio is None:
|
676 |
-
return
|
677 |
-
"state": state,
|
678 |
-
"status": gr.update(visible=True, value="축원 문장을 먼저 녹음해주세요."),
|
679 |
-
"result": gr.update(visible=False),
|
680 |
-
"blessing_visible": True,
|
681 |
-
"guide_visible": False
|
682 |
-
}
|
683 |
|
684 |
try:
|
685 |
features = calculate_baseline_features(audio)
|
686 |
if features is None:
|
687 |
-
return
|
688 |
-
"state": state,
|
689 |
-
"status": gr.update(visible=True, value="음성 분석에 실패했습니다. 다시 시도해주세요."),
|
690 |
-
"result": gr.update(visible=False),
|
691 |
-
"blessing_visible": True,
|
692 |
-
"guide_visible": False
|
693 |
-
}
|
694 |
|
695 |
# 감정 분석
|
696 |
baseline_emotion = map_acoustic_to_emotion(features)
|
@@ -709,22 +697,16 @@ def create_interface():
|
|
709 |
new_state = {**state, "baseline_features": features, "analysis_complete": True}
|
710 |
|
711 |
# 분석이 완료되면 다음 단계로 진행
|
712 |
-
return
|
713 |
-
|
714 |
-
"
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
|
720 |
except Exception as e:
|
721 |
-
return {
|
722 |
-
"state": state,
|
723 |
-
"status": gr.update(visible=True, value=f"오류가 발생했습니다: {str(e)}"),
|
724 |
-
"result": gr.update(visible=False),
|
725 |
-
"blessing_visible": True,
|
726 |
-
"guide_visible": False
|
727 |
-
}
|
728 |
|
729 |
# 4단계: 굿판 입장 안내
|
730 |
entry_guide_section = gr.Column(visible=False)
|
|
|
673 |
def handle_blessing_complete(audio, state):
|
674 |
"""축원 완료 및 분석 처리"""
|
675 |
if audio is None:
|
676 |
+
return state, "음성을 먼저 녹음해주세요.", "", gr.update(visible=True), gr.update(visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
|
678 |
try:
|
679 |
features = calculate_baseline_features(audio)
|
680 |
if features is None:
|
681 |
+
return state, "음성 분석에 실패했습니다. 다시 시도해주세요.", "", gr.update(visible=True), gr.update(visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
682 |
|
683 |
# 감정 분석
|
684 |
baseline_emotion = map_acoustic_to_emotion(features)
|
|
|
697 |
new_state = {**state, "baseline_features": features, "analysis_complete": True}
|
698 |
|
699 |
# 분석이 완료되면 다음 단계로 진행
|
700 |
+
return (
|
701 |
+
new_state,
|
702 |
+
"축원이 완료되었습니다.",
|
703 |
+
analysis_text,
|
704 |
+
gr.update(visible=False),
|
705 |
+
gr.update(visible=True)
|
706 |
+
)
|
707 |
|
708 |
except Exception as e:
|
709 |
+
return state, f"오류가 발생했습니다: {str(e)}", "", gr.update(visible=True), gr.update(visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
710 |
|
711 |
# 4단계: 굿판 입장 안내
|
712 |
entry_guide_section = gr.Column(visible=False)
|