Spaces:
Runtime error
Runtime error
ryanrwatkins
commited on
Commit
Β·
8d4bf4d
1
Parent(s):
970f817
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import openai
|
|
3 |
import requests
|
4 |
import csv
|
5 |
|
6 |
-
prompt_templates = {"
|
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("""##
|
102 |
-
|
103 |
-
|
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
|
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="
|
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="
|
120 |
-
max_tokens = gr.Slider(minimum=100, maximum=
|
121 |
-
context_length = gr.Slider(minimum=1, maximum=10, value=2, step=1, label="Context length", info="Number of previous
|
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>''')
|