Spaces:
Running
Running
key_moments_state
Browse files
app.py
CHANGED
@@ -2012,7 +2012,7 @@ def init_params(text, request: gr.Request):
|
|
2012 |
|
2013 |
return admin, reading_passage_admin, summary_admin, see_detail, password_text, youtube_link
|
2014 |
|
2015 |
-
def update_state(content_subject, content_grade, trascript, question_1, question_2, question_3):
|
2016 |
# inputs=[content_subject, content_grade, df_string_output],
|
2017 |
# outputs=[content_subject_state, content_grade_state, trascript_state]
|
2018 |
content_subject_state = content_subject
|
@@ -2020,12 +2020,14 @@ def update_state(content_subject, content_grade, trascript, question_1, question
|
|
2020 |
trascript_json = json.loads(trascript)
|
2021 |
formatted_simple_transcript = create_formatted_simple_transcript(trascript_json)
|
2022 |
trascript_state = formatted_simple_transcript
|
|
|
2023 |
streaming_chat_thread_id_state = create_thread_id()
|
2024 |
ai_chatbot_question_1 = question_1
|
2025 |
ai_chatbot_question_2 = question_2
|
2026 |
ai_chatbot_question_3 = question_3
|
2027 |
|
2028 |
-
return content_subject_state, content_grade_state, trascript_state,
|
|
|
2029 |
ai_chatbot_question_1, ai_chatbot_question_2, ai_chatbot_question_3
|
2030 |
|
2031 |
|
@@ -2106,6 +2108,7 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
2106 |
content_subject_state = gr.State() # 使用 gr.State 存储 content_subject
|
2107 |
content_grade_state = gr.State() # 使用 gr.State 存储 content_grade
|
2108 |
trascript_state = gr.State() # 使用 gr.State 存储 trascript
|
|
|
2109 |
streaming_chat_thread_id_state = gr.State() # 使用 gr.State 存储 streaming_chat_thread_id
|
2110 |
with gr.Tab("AI小精靈"):
|
2111 |
with gr.Row():
|
@@ -2128,7 +2131,7 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
2128 |
msg = gr.Textbox(label="訊息",scale=3)
|
2129 |
send_button = gr.Button("送出", variant="primary", scale=1)
|
2130 |
with gr.Tab("飛特音速"):
|
2131 |
-
additional_inputs = [password, streaming_chat_thread_id_state, trascript_state, content_subject_state, content_grade_state]
|
2132 |
streaming_chat = gr.ChatInterface(
|
2133 |
fn=streaming_chat_with_open_ai,
|
2134 |
additional_inputs=additional_inputs,
|
@@ -2398,6 +2401,7 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
2398 |
content_subject,
|
2399 |
content_grade,
|
2400 |
df_string_output,
|
|
|
2401 |
btn_1,
|
2402 |
btn_2,
|
2403 |
btn_3
|
@@ -2405,7 +2409,8 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
2405 |
update_state_outputs = [
|
2406 |
content_subject_state,
|
2407 |
content_grade_state,
|
2408 |
-
trascript_state,
|
|
|
2409 |
streaming_chat_thread_id_state,
|
2410 |
ai_chatbot_question_1,
|
2411 |
ai_chatbot_question_2,
|
|
|
2012 |
|
2013 |
return admin, reading_passage_admin, summary_admin, see_detail, password_text, youtube_link
|
2014 |
|
2015 |
+
def update_state(content_subject, content_grade, trascript, key_moments, question_1, question_2, question_3):
|
2016 |
# inputs=[content_subject, content_grade, df_string_output],
|
2017 |
# outputs=[content_subject_state, content_grade_state, trascript_state]
|
2018 |
content_subject_state = content_subject
|
|
|
2020 |
trascript_json = json.loads(trascript)
|
2021 |
formatted_simple_transcript = create_formatted_simple_transcript(trascript_json)
|
2022 |
trascript_state = formatted_simple_transcript
|
2023 |
+
key_moments_state = key_moments
|
2024 |
streaming_chat_thread_id_state = create_thread_id()
|
2025 |
ai_chatbot_question_1 = question_1
|
2026 |
ai_chatbot_question_2 = question_2
|
2027 |
ai_chatbot_question_3 = question_3
|
2028 |
|
2029 |
+
return content_subject_state, content_grade_state, trascript_state, key_moments_state, \
|
2030 |
+
streaming_chat_thread_id_state, \
|
2031 |
ai_chatbot_question_1, ai_chatbot_question_2, ai_chatbot_question_3
|
2032 |
|
2033 |
|
|
|
2108 |
content_subject_state = gr.State() # 使用 gr.State 存储 content_subject
|
2109 |
content_grade_state = gr.State() # 使用 gr.State 存储 content_grade
|
2110 |
trascript_state = gr.State() # 使用 gr.State 存储 trascript
|
2111 |
+
key_moments_state = gr.State() # 使用 gr.State 存储 key_moments
|
2112 |
streaming_chat_thread_id_state = gr.State() # 使用 gr.State 存储 streaming_chat_thread_id
|
2113 |
with gr.Tab("AI小精靈"):
|
2114 |
with gr.Row():
|
|
|
2131 |
msg = gr.Textbox(label="訊息",scale=3)
|
2132 |
send_button = gr.Button("送出", variant="primary", scale=1)
|
2133 |
with gr.Tab("飛特音速"):
|
2134 |
+
additional_inputs = [password, streaming_chat_thread_id_state, trascript_state, key_moments_state, content_subject_state, content_grade_state]
|
2135 |
streaming_chat = gr.ChatInterface(
|
2136 |
fn=streaming_chat_with_open_ai,
|
2137 |
additional_inputs=additional_inputs,
|
|
|
2401 |
content_subject,
|
2402 |
content_grade,
|
2403 |
df_string_output,
|
2404 |
+
key_moments,
|
2405 |
btn_1,
|
2406 |
btn_2,
|
2407 |
btn_3
|
|
|
2409 |
update_state_outputs = [
|
2410 |
content_subject_state,
|
2411 |
content_grade_state,
|
2412 |
+
trascript_state,
|
2413 |
+
key_moments_state,
|
2414 |
streaming_chat_thread_id_state,
|
2415 |
ai_chatbot_question_1,
|
2416 |
ai_chatbot_question_2,
|