Spaces:
Runtime error
Runtime error
ryanrwatkins
commited on
Commit
Β·
6570355
1
Parent(s):
6141b10
Update app.py
Browse files
app.py
CHANGED
@@ -111,7 +111,8 @@ 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 |
#user_token = gr.Textbox(value='', placeholder="OpenAI API Key", type="password", show_label=False)
|
116 |
key = os.environ['openai_key']
|
117 |
prompt_template = gr.Dropdown(label="Choose a guru:", choices=list(prompt_templates.keys()))
|
@@ -124,8 +125,8 @@ with gr.Blocks(css=css) as demo:
|
|
124 |
gr.HTML('''<br><br><br><center>You can duplicate this Space to skip the queue:<a href="https://huggingface.co/spaces/anzorq/chatgpt-demo?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a><br>
|
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, [
|
128 |
-
input_message.submit(submit_message, [
|
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 |
key.change(key_change, inputs=[key], outputs=[])
|
|
|
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 |
+
key = os.environ['openai_key']
|
115 |
+
gr.Markdown(key, elem_id="label")
|
116 |
#user_token = gr.Textbox(value='', placeholder="OpenAI API Key", type="password", show_label=False)
|
117 |
key = os.environ['openai_key']
|
118 |
prompt_template = gr.Dropdown(label="Choose a guru:", choices=list(prompt_templates.keys()))
|
|
|
125 |
gr.HTML('''<br><br><br><center>You can duplicate this Space to skip the queue:<a href="https://huggingface.co/spaces/anzorq/chatgpt-demo?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a><br>
|
126 |
<p><img src="https://visitor-badge.glitch.me/badge?page_id=anzorq.chatgpt_api_demo_hf" alt="visitors"></p></center>''')
|
127 |
|
128 |
+
btn_submit.click(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
129 |
+
input_message.submit(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
130 |
btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
|
131 |
prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[prompt_template_preview])
|
132 |
key.change(key_change, inputs=[key], outputs=[])
|