haohsiang commited on
Commit
432149d
·
1 Parent(s): ef1e5ee

add some parameters for launching and downgrade to 4.36.1

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +5 -4
README.md CHANGED
@@ -1,7 +1,7 @@
1
  ---
2
  title: self-healing-bot
3
  sdk: gradio
4
- sdk_version: 4.44.1
5
  emoji: 👂🏻
6
  colorFrom: blue
7
  colorTo: yellow
 
1
  ---
2
  title: self-healing-bot
3
  sdk: gradio
4
+ sdk_version: 4.36.1
5
  emoji: 👂🏻
6
  colorFrom: blue
7
  colorTo: yellow
app.py CHANGED
@@ -81,6 +81,7 @@ def chat_with_bot(input_text, history, conversation_times, valence_scores, arous
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
@@ -168,7 +169,7 @@ def chat_about_image(input_text, history, selected_image):
168
  gr.update(visible=True) # chatbot_interface
169
  )
170
 
171
- audio_file = "./meditation_v2.mp3"
172
 
173
  # UI handle functions
174
  def handle_chat(input_text, history, conversation_times, valence_scores, arousal_scores, meditation_flag):
@@ -236,7 +237,7 @@ async def show_loading():
236
  "載入時間約需十秒,建議戴上耳機體驗。\n在接下來的畫面,你會看到播放介面,按下播放鈕後就會開始播放指導語",
237
  gr.update(visible=False), # main_interface
238
  gr.update(visible=False)) # audio_interface
239
- # 等待 10
240
  await asyncio.sleep(12)
241
  # 清除訊息
242
  yield (gr.update(visible=False), # loading_message
@@ -333,5 +334,5 @@ with gr.Blocks(theme=theme, css=css) as demo:
333
  gen_other_img.click(generate_images, [chatbot, conversation_times, last_genimg_times, generated_images], [conversation_times, last_genimg_times] + image_outputs)
334
 
335
  if __name__ == "__main__":
336
- demo.queue(max_size=30)
337
- demo.launch(show_api=False)
 
81
 
82
  # 判斷是否建議放鬆練習
83
  if 4.5 <= arousal <= 5.5 and meditation_flag is True: # 詢問是否進行放鬆練習
84
+ time.sleep(1.5)
85
  response = "我知道你的狀況了\n我有一個建議,我們來進行一個可以讓自己放鬆的呼吸練習好嗎?"
86
  history.append((input_text, response))
87
  med_confirm_layout = True
 
169
  gr.update(visible=True) # chatbot_interface
170
  )
171
 
172
+ audio_file = "./meditation_v2.m4a"
173
 
174
  # UI handle functions
175
  def handle_chat(input_text, history, conversation_times, valence_scores, arousal_scores, meditation_flag):
 
237
  "載入時間約需十秒,建議戴上耳機體驗。\n在接下來的畫面,你會看到播放介面,按下播放鈕後就會開始播放指導語",
238
  gr.update(visible=False), # main_interface
239
  gr.update(visible=False)) # audio_interface
240
+ # 等待 12
241
  await asyncio.sleep(12)
242
  # 清除訊息
243
  yield (gr.update(visible=False), # loading_message
 
334
  gen_other_img.click(generate_images, [chatbot, conversation_times, last_genimg_times, generated_images], [conversation_times, last_genimg_times] + image_outputs)
335
 
336
  if __name__ == "__main__":
337
+ demo.queue(max_size=30, default_concurrency_limit=20)
338
+ demo.launch(show_api=False, max_threads=40, share=True)