lzl1005 commited on
Commit
a6b7f72
·
verified ·
1 Parent(s): e0c33d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -121,7 +121,7 @@ def admin_copilot_generator(template_id: str, topic: str, date: str, location: s
121
  except (KeyError, json.JSONDecodeError) as e:
122
  return f"ERROR: Failed to parse LLM structured output. {e}"
123
 
124
- # --- Module B: Teaching AI Designer (Gradio Wrapper) ---
125
 
126
  def lesson_plan_designer(grade: str, subject: str, topic: str, hours: float, method: str, equipment: str, class_needs: str) -> str:
127
  """
@@ -141,7 +141,7 @@ def lesson_plan_designer(grade: str, subject: str, topic: str, hours: float, met
141
  # System Prompt defined for the Teaching Designer
142
  system_prompt = (
143
  "角色:台灣國高中資深教師與課程設計師\n"
144
- "輸出:JSON(教案標題、目標、課綱對齊、活動步驟、評量規準、差異化建議)\n"
145
  "限制:活動分鏡以 15 分鐘粒度;至少 2 項形成性評量。\n"
146
  "對齊:請將輸出中的 'curriculum_alignment' 欄位,對齊台灣課綱的關鍵能力/素養。"
147
  )
@@ -185,7 +185,7 @@ admin_copilot_interface = gr.Interface(
185
  outputs=gr.JSON(label="AI 生成結構化 JSON (用於 DOCX 模板匯出)"),
186
  title="行政 Copilot:會議記錄生成 (Admin Copilot: Meeting Minutes Generation)",
187
  description="🎯 生成格式嚴謹的行政文件 JSON 結構,可直接用於 DOCX 模板套印。",
188
- allow_flagging="never",
189
  )
190
 
191
  # Module B Interface (Teaching Designer)
@@ -196,14 +196,14 @@ lesson_plan_designer_interface = gr.Interface(
196
  gr.Textbox(label="學科 (Subject)", value="歷史"),
197
  gr.Textbox(label="單元主題 (Unit Topic)", value="從茶葉看全球化:17-19世紀的貿易網絡"),
198
  gr.Slider(label="課時數 (Number of Sessions)", minimum=1, maximum=10, step=1, value=4),
199
- gr.Dropdown(label="教學法偏好 (Pedagogy Preference)", choices=["探究式、PBL", "翻轉教學", "合作學習", "講述法"], value="探究式、PBL"),
200
  gr.Textbox(label="可用設備 (Available Equipment)", value="平板電腦、投影設備、網路"),
201
  gr.Textbox(label="班級特性 (Class Characteristics)", value="班級組成多元,需考慮多樣化的史料呈現方式。"),
202
  ],
203
  outputs=gr.JSON(label="AI 生成教案與評量規準 JSON (Lesson Plan & Rubric JSON)"),
204
- title="教學 AI 設計器:教案與 Rubric 生成 (Teaching AI Designer: Lesson Plan & Rubric)",
205
  description="📘 生成符合課綱精神的單元教案結構和評量規準 JSON。",
206
- allow_flagging="never",
207
  )
208
 
209
  # Integrate the two modules into a Tabbed Interface
@@ -214,3 +214,9 @@ demo = gr.TabbedInterface(
214
  theme=gr.themes.Soft()
215
  )
216
 
 
 
 
 
 
 
 
121
  except (KeyError, json.JSONDecodeError) as e:
122
  return f"ERROR: Failed to parse LLM structured output. {e}"
123
 
124
+ # --- Module B: Teaching AI Designer (Gio Wrapper) ---
125
 
126
  def lesson_plan_designer(grade: str, subject: str, topic: str, hours: float, method: str, equipment: str, class_needs: str) -> str:
127
  """
 
141
  # System Prompt defined for the Teaching Designer
142
  system_prompt = (
143
  "角色:台灣國高中資深教師與課程設計師\n"
144
+ "輸出:JSON(教案標題、目標、課綱對齊、活動步驟、評量規Z、差異化建議)\n"
145
  "限制:活動分鏡以 15 分鐘粒度;至少 2 項形成性評量。\n"
146
  "對齊:請將輸出中的 'curriculum_alignment' 欄位,對齊台灣課綱的關鍵能力/素養。"
147
  )
 
185
  outputs=gr.JSON(label="AI 生成結構化 JSON (用於 DOCX 模板匯出)"),
186
  title="行政 Copilot:會議記錄生成 (Admin Copilot: Meeting Minutes Generation)",
187
  description="🎯 生成格式嚴謹的行政文件 JSON 結構,可直接用於 DOCX 模板套印。",
188
+ flagging_mode="never", # Updated from allow_flagging
189
  )
190
 
191
  # Module B Interface (Teaching Designer)
 
196
  gr.Textbox(label="學科 (Subject)", value="歷史"),
197
  gr.Textbox(label="單元主題 (Unit Topic)", value="從茶葉看全球化:17-19世紀的貿易網絡"),
198
  gr.Slider(label="課時數 (Number of Sessions)", minimum=1, maximum=10, step=1, value=4),
199
+ gr.Dropdown(label="教學法偏好 (Pedagogy Preference)", choices=["探究式、PBL", "翻轉教學", "合作學習", "講述法"], value="探究式、PB L"], value="探究式、PBL"),
200
  gr.Textbox(label="可用設備 (Available Equipment)", value="平板電腦、投影設備、網路"),
201
  gr.Textbox(label="班級特性 (Class Characteristics)", value="班級組成多元,需考慮多樣化的史料呈現方式。"),
202
  ],
203
  outputs=gr.JSON(label="AI 生成教案與評量規準 JSON (Lesson Plan & Rubric JSON)"),
204
+ title="教學 AI 設計器:教案與 Rubric 生成 (Teaching AI Designer: Lesson Plan & RubGric)",
205
  description="📘 生成符合課綱精神的單元教案結構和評量規準 JSON。",
206
+ flagging_mode="never", # Updated from allow_flagging
207
  )
208
 
209
  # Integrate the two modules into a Tabbed Interface
 
214
  theme=gr.themes.Soft()
215
  )
216
 
217
+ # --- Launch the application ---
218
+ # This is required for the application to start in the container
219
+ if __name__ == "__main__":
220
+ demo.launch()
221
+
222
+