Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- chatgpt.py +29 -26
chatgpt.py
CHANGED
@@ -303,19 +303,19 @@ with gr.Blocks(css=css) as app:
|
|
303 |
with gr.Column(scale=1, min_width=250):
|
304 |
gr.Markdown("## Settings")
|
305 |
|
306 |
-
#
|
307 |
-
with gr.Box():
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
|
320 |
# fetch initial prompts based on the default chatbot type
|
321 |
system_prompt_value, conv_instruction_prompt_value, therapy_prompt_value, autobio_prompt_value = update_prompts('Echo')
|
@@ -372,31 +372,35 @@ with gr.Blocks(css=css) as app:
|
|
372 |
system_prompt = gr.Textbox(
|
373 |
label="System Prompt",
|
374 |
placeholder="Enter the system prompt here.",
|
375 |
-
value=system_prompt_value['value']
|
|
|
376 |
)
|
377 |
conv_instruction_prompt = gr.Textbox(
|
378 |
label="Conversation Instruction Prompt",
|
379 |
placeholder="Enter the instruction for each conversation here.",
|
380 |
-
value=conv_instruction_prompt_value['value']
|
|
|
381 |
)
|
382 |
therapy_prompt = gr.Textbox(
|
383 |
label="Therapy Prompt",
|
384 |
placeholder="Enter the instruction for reminiscence therapy.",
|
385 |
-
value=therapy_prompt_value['value']
|
|
|
386 |
)
|
387 |
autobio_prompt = gr.Textbox(
|
388 |
label="Autobiography Generation Prompt",
|
389 |
placeholder="Enter the instruction for autobiography generation.",
|
390 |
-
value=autobio_prompt_value['value']
|
391 |
-
|
392 |
-
|
393 |
-
# update prompts when chatbot_type changes
|
394 |
-
chatbot_type_dropdown.change(
|
395 |
-
fn=update_prompts,
|
396 |
-
inputs=[chatbot_type_dropdown],
|
397 |
-
outputs=[system_prompt, conv_instruction_prompt, therapy_prompt, autobio_prompt]
|
398 |
)
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
with gr.Box():
|
401 |
gr.Markdown("### User Information")
|
402 |
username_input = gr.Textbox(
|
@@ -406,7 +410,6 @@ with gr.Blocks(css=css) as app:
|
|
406 |
api_key_input = gr.Textbox(
|
407 |
label="OpenAI API Key",
|
408 |
placeholder="Enter your openai api key",
|
409 |
-
value="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",
|
410 |
type="password"
|
411 |
)
|
412 |
|
@@ -418,7 +421,7 @@ with gr.Blocks(css=css) as app:
|
|
418 |
initialize_button.click(
|
419 |
fn=set_initialize_button,
|
420 |
inputs=[api_key_input, chapter_dropdown, method_dropdown, username_input,
|
421 |
-
system_prompt, conv_instruction_prompt, therapy_prompt, autobio_prompt, chatbot_type_dropdown
|
422 |
outputs=[initialization_status, api_key_state, chatbot_type_state],
|
423 |
)
|
424 |
|
|
|
303 |
with gr.Column(scale=1, min_width=250):
|
304 |
gr.Markdown("## Settings")
|
305 |
|
306 |
+
# Commented out Chatbot Type Selection dropdown
|
307 |
+
# with gr.Box():
|
308 |
+
# gr.Markdown("### Chatbot Selection")
|
309 |
+
# chatbot_type_dropdown = gr.Dropdown(
|
310 |
+
# label="Select Chatbot Type",
|
311 |
+
# choices=['Echo', 'Breeze'],
|
312 |
+
# value='Echo',
|
313 |
+
# )
|
314 |
+
# chatbot_type_dropdown.change(
|
315 |
+
# fn=update_chatbot_type,
|
316 |
+
# inputs=[chatbot_type_dropdown],
|
317 |
+
# outputs=[chatbot_type_state]
|
318 |
+
# )
|
319 |
|
320 |
# fetch initial prompts based on the default chatbot type
|
321 |
system_prompt_value, conv_instruction_prompt_value, therapy_prompt_value, autobio_prompt_value = update_prompts('Echo')
|
|
|
372 |
system_prompt = gr.Textbox(
|
373 |
label="System Prompt",
|
374 |
placeholder="Enter the system prompt here.",
|
375 |
+
value=system_prompt_value['value'],
|
376 |
+
lines=15
|
377 |
)
|
378 |
conv_instruction_prompt = gr.Textbox(
|
379 |
label="Conversation Instruction Prompt",
|
380 |
placeholder="Enter the instruction for each conversation here.",
|
381 |
+
value=conv_instruction_prompt_value['value'],
|
382 |
+
lines=15
|
383 |
)
|
384 |
therapy_prompt = gr.Textbox(
|
385 |
label="Therapy Prompt",
|
386 |
placeholder="Enter the instruction for reminiscence therapy.",
|
387 |
+
value=therapy_prompt_value['value'],
|
388 |
+
lines=15
|
389 |
)
|
390 |
autobio_prompt = gr.Textbox(
|
391 |
label="Autobiography Generation Prompt",
|
392 |
placeholder="Enter the instruction for autobiography generation.",
|
393 |
+
value=autobio_prompt_value['value'],
|
394 |
+
lines=15
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
)
|
396 |
|
397 |
+
# Update prompts when chatbot_type changes
|
398 |
+
# commented chatbot_type_dropdown.change as it's no longer needed
|
399 |
+
# chatbot_type_dropdown.change(
|
400 |
+
# fn=update_prompts,
|
401 |
+
# inputs=[chatbot_type_dropdown],
|
402 |
+
# outputs=[system_prompt, conv_instruction_prompt, therapy_prompt, autobio_prompt]
|
403 |
+
# )
|
404 |
with gr.Box():
|
405 |
gr.Markdown("### User Information")
|
406 |
username_input = gr.Textbox(
|
|
|
410 |
api_key_input = gr.Textbox(
|
411 |
label="OpenAI API Key",
|
412 |
placeholder="Enter your openai api key",
|
|
|
413 |
type="password"
|
414 |
)
|
415 |
|
|
|
421 |
initialize_button.click(
|
422 |
fn=set_initialize_button,
|
423 |
inputs=[api_key_input, chapter_dropdown, method_dropdown, username_input,
|
424 |
+
system_prompt, conv_instruction_prompt, therapy_prompt, autobio_prompt,], # chatbot_type_dropdown replaced with None
|
425 |
outputs=[initialization_status, api_key_state, chatbot_type_state],
|
426 |
)
|
427 |
|