Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -57,7 +57,7 @@ with gr.Blocks() as demo:
|
|
57 |
with gr.Row():
|
58 |
with gr.Column():
|
59 |
system_prompt_name = gr.Dropdown(choices=list(system_prompts.keys()), label="Select System Prompt")
|
60 |
-
system_prompt_content = gr.TextArea(label="System Prompt", value="", lines=4)
|
61 |
save_prompt_button = gr.Button("Save System Prompt")
|
62 |
|
63 |
user_input = gr.TextArea(label="Enter your prompt", placeholder="Describe the character or request a detailed description...", lines=4)
|
@@ -69,7 +69,11 @@ with gr.Blocks() as demo:
|
|
69 |
def load_prompt(name):
|
70 |
return get_prompt(name)
|
71 |
|
72 |
-
system_prompt_name.change(
|
|
|
|
|
|
|
|
|
73 |
save_prompt_button.click(update_prompt, inputs=[system_prompt_name, system_prompt_content], outputs=[])
|
74 |
submit_button.click(chat_with_model, inputs=[user_input, system_prompt_content], outputs=[output])
|
75 |
|
|
|
57 |
with gr.Row():
|
58 |
with gr.Column():
|
59 |
system_prompt_name = gr.Dropdown(choices=list(system_prompts.keys()), label="Select System Prompt")
|
60 |
+
system_prompt_content = gr.TextArea(label="System Prompt", value=get_prompt("default"), lines=4)
|
61 |
save_prompt_button = gr.Button("Save System Prompt")
|
62 |
|
63 |
user_input = gr.TextArea(label="Enter your prompt", placeholder="Describe the character or request a detailed description...", lines=4)
|
|
|
69 |
def load_prompt(name):
|
70 |
return get_prompt(name)
|
71 |
|
72 |
+
system_prompt_name.change(
|
73 |
+
lambda name: (name, get_prompt(name)),
|
74 |
+
inputs=[system_prompt_name],
|
75 |
+
outputs=[system_prompt_name, system_prompt_content]
|
76 |
+
)
|
77 |
save_prompt_button.click(update_prompt, inputs=[system_prompt_name, system_prompt_content], outputs=[])
|
78 |
submit_button.click(chat_with_model, inputs=[user_input, system_prompt_content], outputs=[output])
|
79 |
|