Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -124,8 +124,8 @@ with gr.Blocks(css=css) as demo:
|
|
124 |
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
125 |
btn_clear_conversation = gr.Button("π Start New Conversation")
|
126 |
with gr.Column():
|
127 |
-
|
128 |
-
user_token=gr.
|
129 |
prompt_template = gr.Dropdown(label="Set a custom insruction for the chatbot:", choices=list(prompt_templates.keys()))
|
130 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview", visible=False)
|
131 |
with gr.Accordion("Advanced parameters", open=False, visible=False):
|
@@ -135,7 +135,7 @@ with gr.Blocks(css=css) as demo:
|
|
135 |
|
136 |
print(user_token)
|
137 |
|
138 |
-
btn_submit.click(submit_message, [
|
139 |
input_message.submit(submit_message, [user_token, input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
140 |
btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
|
141 |
prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[prompt_template_preview])
|
|
|
124 |
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
125 |
btn_clear_conversation = gr.Button("π Start New Conversation")
|
126 |
with gr.Column():
|
127 |
+
gr.Markdown("OpenAI API Key.", elem_id="label")
|
128 |
+
user_token=gr.Textbox(value=API, type="password", placeholder=API, visible=True, readonly=True)
|
129 |
prompt_template = gr.Dropdown(label="Set a custom insruction for the chatbot:", choices=list(prompt_templates.keys()))
|
130 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview", visible=False)
|
131 |
with gr.Accordion("Advanced parameters", open=False, visible=False):
|
|
|
135 |
|
136 |
print(user_token)
|
137 |
|
138 |
+
btn_submit.click(submit_message, [user_token,input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
139 |
input_message.submit(submit_message, [user_token, input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
140 |
btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
|
141 |
prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[prompt_template_preview])
|