Update app.py
Browse files
app.py
CHANGED
@@ -80,7 +80,7 @@ def chat_with_bot(input_text, history, conversation_times, valence_scores, arous
|
|
80 |
valence, arousal, conversation_times, valence_scores, arousal_scores = analyze_sentiment_corpus(input_text, conversation_times, valence_scores, arousal_scores)
|
81 |
|
82 |
# 判斷是否建議放鬆練習
|
83 |
-
if 5 <= arousal <=
|
84 |
response = "我知道你的狀況了\n我有一個建議,我們來進行一個可以讓自己放鬆的呼吸練習好嗎?"
|
85 |
history.append((input_text, response))
|
86 |
med_confirm_layout = True
|
@@ -291,7 +291,7 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
291 |
|
292 |
with gr.Row() as main_interface:
|
293 |
with gr.Column() as chatbot_interface:
|
294 |
-
chatbot = gr.Chatbot(label="聊天機器人", show_share_button=False, bubble_full_width=False, scale=6)
|
295 |
msg = gr.Textbox(show_label=False, placeholder="今天想要跟我分享什麼呢?", autofocus=True, scale=2)
|
296 |
with gr.Row():
|
297 |
submit = gr.Button("送出", variant="primary", scale=2)
|
|
|
80 |
valence, arousal, conversation_times, valence_scores, arousal_scores = analyze_sentiment_corpus(input_text, conversation_times, valence_scores, arousal_scores)
|
81 |
|
82 |
# 判斷是否建議放鬆練習
|
83 |
+
if 4.5 <= arousal <= 5.5 and meditation_flag is True: # 詢問是否進行放鬆練習
|
84 |
response = "我知道你的狀況了\n我有一個建議,我們來進行一個可以讓自己放鬆的呼吸練習好嗎?"
|
85 |
history.append((input_text, response))
|
86 |
med_confirm_layout = True
|
|
|
291 |
|
292 |
with gr.Row() as main_interface:
|
293 |
with gr.Column() as chatbot_interface:
|
294 |
+
chatbot = gr.Chatbot(label="聊天機器人", show_share_button=False, bubble_full_width=False, autoscroll=True, layout='bubble', scale=6)
|
295 |
msg = gr.Textbox(show_label=False, placeholder="今天想要跟我分享什麼呢?", autofocus=True, scale=2)
|
296 |
with gr.Row():
|
297 |
submit = gr.Button("送出", variant="primary", scale=2)
|