Lashtw commited on
Commit
c6f9b7e
·
verified ·
1 Parent(s): d19c6c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -38,6 +38,10 @@ def display_teams():
38
  display += f"{team} ({', '.join(students)}): [{health_bar}] {health}/{max_health}\n"
39
  return display.strip()
40
 
 
 
 
 
41
  # Gradio 介面
42
  with gr.Blocks() as app:
43
  gr.Markdown("## 雞排王小隊對戰系統")
@@ -65,15 +69,7 @@ with gr.Blocks() as app:
65
  # 事件綁定
66
  attack_button.click(attack_team, inputs=[team_dropdown, damage_input], outputs=attack_output)
67
  display_button.click(display_teams, outputs=teams_display)
68
-
69
- # 更新選單小隊名稱
70
- def update_team_dropdown():
71
- return list(groups.keys())
72
- init_button.click(update_team_dropdown, outputs=team_dropdown)
73
 
74
  # 啟動應用程式
75
  app.launch()
76
-
77
-
78
-
79
-
 
38
  display += f"{team} ({', '.join(students)}): [{health_bar}] {health}/{max_health}\n"
39
  return display.strip()
40
 
41
+ # 更新小隊選項
42
+ def update_team_dropdown():
43
+ return list(groups.keys())
44
+
45
  # Gradio 介面
46
  with gr.Blocks() as app:
47
  gr.Markdown("## 雞排王小隊對戰系統")
 
69
  # 事件綁定
70
  attack_button.click(attack_team, inputs=[team_dropdown, damage_input], outputs=attack_output)
71
  display_button.click(display_teams, outputs=teams_display)
72
+ init_button.click(update_team_dropdown, outputs=team_dropdown) # 初始化後更新選項
 
 
 
 
73
 
74
  # 啟動應用程式
75
  app.launch()