ryanrwatkins commited on
Commit
8d4bf4d
Β·
1 Parent(s): 970f817

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -3,7 +3,7 @@ import openai
3
  import requests
4
  import csv
5
 
6
- prompt_templates = {"Default ChatGPT": ""}
7
 
8
  def get_empty_state():
9
  return {"total_tokens": 0, "messages": []}
@@ -98,27 +98,27 @@ with gr.Blocks(css=css) as demo:
98
 
99
 
100
  with gr.Column(elem_id="col-container"):
101
- gr.Markdown("""## OpenAI ChatGPT Demo
102
- Using the ofiicial API (gpt-3.5-turbo model)
103
- Prompt templates from [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts).""",
104
  elem_id="header")
105
 
106
  with gr.Row():
107
  with gr.Column():
108
  chatbot = gr.Chatbot(elem_id="chatbox")
109
- input_message = gr.Textbox(show_label=False, placeholder="Enter text and press enter", visible=True).style(container=False)
110
  btn_submit = gr.Button("Submit")
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
- prompt_template = gr.Dropdown(label="Set a custom insruction for the chatbot:", choices=list(prompt_templates.keys()))
117
  prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
118
  with gr.Accordion("Advanced parameters", open=False):
119
- temperature = gr.Slider(minimum=0, maximum=2.0, value=0.7, step=0.1, label="Temperature", info="Higher = more creative/chaotic")
120
- max_tokens = gr.Slider(minimum=100, maximum=4096, value=1000, step=1, label="Max tokens per response")
121
- context_length = gr.Slider(minimum=1, maximum=10, value=2, step=1, label="Context length", info="Number of previous messages to send to the chatbot. Be careful with high values, it can blow up the token budget quickly.")
122
 
123
  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>
124
  <p><img src="https://visitor-badge.glitch.me/badge?page_id=anzorq.chatgpt_api_demo_hf" alt="visitors"></p></center>''')
 
3
  import requests
4
  import csv
5
 
6
+ prompt_templates = {"All Needs Gurus": ""}
7
 
8
  def get_empty_state():
9
  return {"total_tokens": 0, "messages": []}
 
98
 
99
 
100
  with gr.Column(elem_id="col-container"):
101
+ gr.Markdown("""## Chat with Needs Assessment Gurus
102
+ Uses ChatGPT to let you have Q&A with experts on needs assessments.
103
+ Ask questions of all of them, or pick your guru.""",
104
  elem_id="header")
105
 
106
  with gr.Row():
107
  with gr.Column():
108
  chatbot = gr.Chatbot(elem_id="chatbox")
109
+ input_message = gr.Textbox(show_label=False, placeholder="Enter needs assessment question and press enter", visible=True).style(container=False)
110
  btn_submit = gr.Button("Submit")
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
+ prompt_template = gr.Dropdown(label="Choose a guru:", choices=list(prompt_templates.keys()))
117
  prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
118
  with gr.Accordion("Advanced parameters", open=False):
119
+ temperature = gr.Slider(minimum=0, maximum=2.0, value=0.7, step=0.1, label="Flexibility", info="Higher = more creative/chaotic, Lower = just the guru")
120
+ max_tokens = gr.Slider(minimum=100, maximum=400, value=400, step=1, label="Max tokens per response")
121
+ context_length = gr.Slider(minimum=1, maximum=10, 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.")
122
 
123
  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>
124
  <p><img src="https://visitor-badge.glitch.me/badge?page_id=anzorq.chatgpt_api_demo_hf" alt="visitors"></p></center>''')