Spaces:
Sleeping
Sleeping
Commit
Β·
119f6c6
1
Parent(s):
6c42480
Update app.py
Browse files
app.py
CHANGED
@@ -111,9 +111,6 @@ with gr.Blocks(css=css) as demo:
|
|
111 |
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
112 |
btn_clear_conversation = gr.Button("π Start New Conversation")
|
113 |
with gr.Column():
|
114 |
-
|
115 |
-
#gr.Markdown(key, elem_id="label")
|
116 |
-
#user_token = gr.Textbox(value='', placeholder="OpenAI API Key", type="password", show_label=False)
|
117 |
prompt_template = gr.Dropdown(label="Choose a guru:", choices=list(prompt_templates.keys()))
|
118 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|
119 |
with gr.Accordion("Advanced parameters", open=False):
|
@@ -121,14 +118,12 @@ with gr.Blocks(css=css) as demo:
|
|
121 |
max_tokens = gr.Slider(minimum=100, maximum=400, value=400, step=1, label="Max tokens per response")
|
122 |
context_length = gr.Slider(minimum=1, maximum=5, value=2, step=1, label="Context length", info="Number of previous questions you have asked. Be careful with high values, it can blow up the token budget quickly.")
|
123 |
|
124 |
-
|
125 |
-
<p><img src="https://visitor-badge.glitch.me/badge?page_id=anzorq.chatgpt_api_demo_hf" alt="visitors"></p></center>''')
|
126 |
-
|
127 |
btn_submit.click(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
128 |
input_message.submit(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
129 |
btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
|
130 |
prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[prompt_template_preview])
|
131 |
-
|
132 |
|
133 |
|
134 |
demo.load(download_prompt_templates, inputs=None, outputs=[prompt_template], queur=False)
|
|
|
111 |
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
112 |
btn_clear_conversation = gr.Button("π Start New Conversation")
|
113 |
with gr.Column():
|
|
|
|
|
|
|
114 |
prompt_template = gr.Dropdown(label="Choose a guru:", choices=list(prompt_templates.keys()))
|
115 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|
116 |
with gr.Accordion("Advanced parameters", open=False):
|
|
|
118 |
max_tokens = gr.Slider(minimum=100, maximum=400, value=400, step=1, label="Max tokens per response")
|
119 |
context_length = gr.Slider(minimum=1, maximum=5, value=2, step=1, label="Context length", info="Number of previous questions you have asked. Be careful with high values, it can blow up the token budget quickly.")
|
120 |
|
121 |
+
|
|
|
|
|
122 |
btn_submit.click(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
123 |
input_message.submit(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
124 |
btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
|
125 |
prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[prompt_template_preview])
|
126 |
+
|
127 |
|
128 |
|
129 |
demo.load(download_prompt_templates, inputs=None, outputs=[prompt_template], queur=False)
|