Spaces:
Runtime error
Runtime error
Commit
Β·
a2107b5
1
Parent(s):
3b08c39
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,9 @@ def download_prompt_templates():
|
|
32 |
if len(row) >= 2:
|
33 |
act = row[0].strip('"')
|
34 |
prompt = row[1].strip('"')
|
|
|
35 |
prompt_templates[act] = prompt
|
|
|
36 |
|
37 |
except requests.exceptions.RequestException as e:
|
38 |
print(f"An error occurred while downloading prompt templates: {e}")
|
@@ -114,9 +116,9 @@ with gr.Blocks(css=css) as demo:
|
|
114 |
|
115 |
with gr.Column(elem_id="col-container"):
|
116 |
|
117 |
-
gr.Markdown("""# Chat with Needs Assessment
|
118 |
## Ask questions of experts on needs assessments, get responses from *needs assessment* version of ChatGPT.
|
119 |
-
Ask questions of all of them, or pick your
|
120 |
elem_id="header")
|
121 |
|
122 |
|
@@ -130,7 +132,7 @@ with gr.Blocks(css=css) as demo:
|
|
130 |
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
131 |
btn_clear_conversation = gr.Button("π Start New Conversation")
|
132 |
with gr.Column():
|
133 |
-
prompt_template = gr.Dropdown(label="Choose a
|
134 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|
135 |
with gr.Accordion("Advanced parameters", open=False):
|
136 |
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")
|
@@ -141,7 +143,7 @@ with gr.Blocks(css=css) as demo:
|
|
141 |
btn_submit.click(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
142 |
input_message.submit(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
143 |
btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
|
144 |
-
prompt_template.change(on_prompt_template_change, inputs=[
|
145 |
|
146 |
|
147 |
|
|
|
32 |
if len(row) >= 2:
|
33 |
act = row[0].strip('"')
|
34 |
prompt = row[1].strip('"')
|
35 |
+
description = row[2].strip('"')
|
36 |
prompt_templates[act] = prompt
|
37 |
+
prompt_templates_description[act] = description
|
38 |
|
39 |
except requests.exceptions.RequestException as e:
|
40 |
print(f"An error occurred while downloading prompt templates: {e}")
|
|
|
116 |
|
117 |
with gr.Column(elem_id="col-container"):
|
118 |
|
119 |
+
gr.Markdown("""# Chat with Needs Assessment Experts (Past and Present)
|
120 |
## Ask questions of experts on needs assessments, get responses from *needs assessment* version of ChatGPT.
|
121 |
+
Ask questions of all of them, or pick your expert.""",
|
122 |
elem_id="header")
|
123 |
|
124 |
|
|
|
132 |
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
133 |
btn_clear_conversation = gr.Button("π Start New Conversation")
|
134 |
with gr.Column():
|
135 |
+
prompt_template = gr.Dropdown(label="Choose a expert:", choices=list(prompt_templates.keys()))
|
136 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|
137 |
with gr.Accordion("Advanced parameters", open=False):
|
138 |
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")
|
|
|
143 |
btn_submit.click(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
144 |
input_message.submit(submit_message, [ input_message, prompt_template, temperature, max_tokens, context_length, state], [input_message, chatbot, total_tokens_str, state])
|
145 |
btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
|
146 |
+
prompt_template.change(on_prompt_template_change, inputs=[prompt_template_description], outputs=[prompt_template_preview])
|
147 |
|
148 |
|
149 |
|