Spaces:
Sleeping
Sleeping
def update_scenario_input(scenario_radio):
Browse files
app.py
CHANGED
@@ -24,6 +24,8 @@ else:
|
|
24 |
|
25 |
OPEN_AI_CLIENT = OpenAI(api_key=OPEN_AI_KEY)
|
26 |
|
|
|
|
|
27 |
|
28 |
def generate_topics(model, max_tokens, sys_content, scenario, eng_level, user_generate_topics_prompt):
|
29 |
"""
|
@@ -498,25 +500,36 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
498 |
with gr.Row():
|
499 |
gr.Markdown("""## 寫作的主題與讀者、寫作的目的、文章的風格、長度、範圍、以及作者的專業知識等都有關係。因為不容易找主題,所以利用兩階段方式來找主題。特為較無英文寫作經驗的 基礎級使用者 提供多種大範圍情境,待篩選情境後,下一步再來決定明確的主題。""")
|
500 |
with gr.Row():
|
501 |
-
|
502 |
-
"
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
|
521 |
# Step 2. 確定段落主題
|
522 |
with gr.Row():
|
|
|
24 |
|
25 |
OPEN_AI_CLIENT = OpenAI(api_key=OPEN_AI_KEY)
|
26 |
|
27 |
+
def update_scenario_input(scenario_radio):
|
28 |
+
return scenario_radio
|
29 |
|
30 |
def generate_topics(model, max_tokens, sys_content, scenario, eng_level, user_generate_topics_prompt):
|
31 |
"""
|
|
|
500 |
with gr.Row():
|
501 |
gr.Markdown("""## 寫作的主題與讀者、寫作的目的、文章的風格、長度、範圍、以及作者的專業知識等都有關係。因為不容易找主題,所以利用兩階段方式來找主題。特為較無英文寫作經驗的 基礎級使用者 提供多種大範圍情境,待篩選情境後,下一步再來決定明確的主題。""")
|
502 |
with gr.Row():
|
503 |
+
with gr.Column():
|
504 |
+
scenario_input = gr.Textbox(label="先選擇一個大範圍的情境或是自定義:")
|
505 |
+
with gr.Column():
|
506 |
+
scenario_values = [
|
507 |
+
"Health",
|
508 |
+
"Thanksgiving",
|
509 |
+
"Halloween",
|
510 |
+
"moon festival in Taiwan",
|
511 |
+
"School and Learning",
|
512 |
+
"Travel and Places",
|
513 |
+
"Family and Friends",
|
514 |
+
"Hobbies and Leisure Activities",
|
515 |
+
"Health and Exercise",
|
516 |
+
"Personal Experiences",
|
517 |
+
"My Future Goals",
|
518 |
+
"School Life",
|
519 |
+
"Pets",
|
520 |
+
"A Problem and Solution",
|
521 |
+
"Holidays and Celebrations",
|
522 |
+
"My Favorite Cartoon/Anime"
|
523 |
+
]
|
524 |
+
scenario_radio_button = gr.Radio(scenario_values, label="Scenario", elem_id="scenario_button")
|
525 |
+
|
526 |
+
scenario_radio_button.select(
|
527 |
+
fn=update_scenario_input,
|
528 |
+
inputs=[scenario_radio_button],
|
529 |
+
outputs=[scenario_input]
|
530 |
+
)
|
531 |
+
|
532 |
+
|
533 |
|
534 |
# Step 2. 確定段落主題
|
535 |
with gr.Row():
|