Update app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,7 @@ def fetch_message(df, num, direction):
|
|
| 33 |
else:
|
| 34 |
return "これ以上のメッセージはありません。", num, ""
|
| 35 |
|
|
|
|
| 36 |
def create_prompt(instruction, num, tone, limit):
|
| 37 |
return f"{instruction}\n## 制約条件\n- {num}文字以上\n- {tone}\n- {limit}\n"
|
| 38 |
|
|
@@ -142,8 +143,8 @@ with gr.Blocks() as demo:
|
|
| 142 |
target.change(create_prompt, [prompt_now, slider_select, target, limit], textbox_submit)
|
| 143 |
limit.change(create_prompt, [prompt_now, slider_select, target, limit], textbox_submit)
|
| 144 |
|
| 145 |
-
button_next.click(lambda df, num: fetch_message(df, num, 1), [df, number_now], [message, number_now, textbox_submit
|
| 146 |
-
button_back.click(lambda df, num: fetch_message(df, num, -1), [df, number_now], [message, number_now, textbox_submit
|
| 147 |
|
| 148 |
button_submit.click(respond, [textbox_submit, chat, system_prompt, model, api_key, temperature, max_tokens], chat)
|
| 149 |
clear_button.add([chat, textbox_submit])
|
|
|
|
| 33 |
else:
|
| 34 |
return "これ以上のメッセージはありません。", num, ""
|
| 35 |
|
| 36 |
+
|
| 37 |
def create_prompt(instruction, num, tone, limit):
|
| 38 |
return f"{instruction}\n## 制約条件\n- {num}文字以上\n- {tone}\n- {limit}\n"
|
| 39 |
|
|
|
|
| 143 |
target.change(create_prompt, [prompt_now, slider_select, target, limit], textbox_submit)
|
| 144 |
limit.change(create_prompt, [prompt_now, slider_select, target, limit], textbox_submit)
|
| 145 |
|
| 146 |
+
button_next.click(lambda df, num: fetch_message(df, num, 1), [df, number_now], [message, number_now, textbox_submit])
|
| 147 |
+
button_back.click(lambda df, num: fetch_message(df, num, -1), [df, number_now], [message, number_now, textbox_submit])
|
| 148 |
|
| 149 |
button_submit.click(respond, [textbox_submit, chat, system_prompt, model, api_key, temperature, max_tokens], chat)
|
| 150 |
clear_button.add([chat, textbox_submit])
|