ryanrwatkins commited on
Commit
6570355
Β·
1 Parent(s): 6141b10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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
- #gr.Markdown("Enter your OpenAI API Key. You can get one [here](https://platform.openai.com/account/api-keys).", elem_id="label")
 
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, [key, input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
128
- input_message.submit(submit_message, [key, 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
  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=[])