Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,8 +25,22 @@ action_log = [] # ページ操作ログ
|
|
| 25 |
|
| 26 |
|
| 27 |
def rewrite_level(text, target_level): # 変更点
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
prompt = f"""
|
| 29 |
-
Rewrite the following passage so it fits about {
|
| 30 |
- Preserve the original meaning faithfully.
|
| 31 |
- Do not add new information or remove essential information.
|
| 32 |
- Output only the rewritten passage. Do not include explanations.
|
|
@@ -298,7 +312,7 @@ with gr.Blocks() as demo:
|
|
| 298 |
gr.Markdown("# 📚 Reading Exercise")
|
| 299 |
|
| 300 |
student_id_input = gr.Textbox(label="学生番号(必須)")
|
| 301 |
-
level_input = gr.Number(label="あなたの Reading Level(
|
| 302 |
|
| 303 |
start_btn = gr.Button("スタート")
|
| 304 |
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
def rewrite_level(text, target_level): # 変更点
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# --- Level → Flesch Reading Ease Score の変換表 ---
|
| 31 |
+
level_to_flesch = {
|
| 32 |
+
1: 90, # 例: とても易しい
|
| 33 |
+
2: 70, # 例: 易しい
|
| 34 |
+
3: 55, # 例: 標準
|
| 35 |
+
4: 40, # 例: やや難しい
|
| 36 |
+
5: 25 # 例: 難しい
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
# target_level を Flesch Score に変換(デフォルト 55)
|
| 40 |
+
target_flesch = level_to_flesch[int(target_level)]
|
| 41 |
+
|
| 42 |
prompt = f"""
|
| 43 |
+
Rewrite the following passage so it fits about {target_flesch} Flesch Reading Ease Score
|
| 44 |
- Preserve the original meaning faithfully.
|
| 45 |
- Do not add new information or remove essential information.
|
| 46 |
- Output only the rewritten passage. Do not include explanations.
|
|
|
|
| 312 |
gr.Markdown("# 📚 Reading Exercise")
|
| 313 |
|
| 314 |
student_id_input = gr.Textbox(label="学生番号(必須)")
|
| 315 |
+
level_input = gr.Number(label="あなたの Reading Level(Level Testの結果を選択)", precision=0) # 変更点
|
| 316 |
|
| 317 |
start_btn = gr.Button("スタート")
|
| 318 |
|