Spaces:
Runtime error
Runtime error
~UI
Browse files
app.py
CHANGED
@@ -102,24 +102,22 @@ with gr.Blocks(css=css) as demo:
|
|
102 |
Prompt templates from [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts).""",
|
103 |
elem_id="header")
|
104 |
|
105 |
-
with gr.
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
max_tokens = gr.Slider(minimum=100, maximum=4096, value=1000, step=1, label="Max tokens per response")
|
122 |
-
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.")
|
123 |
|
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>''')
|
|
|
102 |
Prompt templates from [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts).""",
|
103 |
elem_id="header")
|
104 |
|
105 |
+
with gr.Row():
|
106 |
+
gr.Markdown("Enter your OpenAI API Key. You can get one [here](https://platform.openai.com/account/api-keys).", elem_id="label")
|
107 |
+
user_token = gr.Textbox(value='', placeholder="OpenAI API Key", type="password", show_label=False)
|
108 |
+
with gr.Column():
|
109 |
+
chatbot = gr.Chatbot(elem_id="chatbox")
|
110 |
+
input_message = gr.Textbox(show_label=False, placeholder="Enter text and press enter", visible=True).style(container=False)
|
111 |
+
btn_submit = gr.Button("Submit")
|
112 |
+
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
113 |
+
btn_clear_conversation = gr.Button("π Start New Conversation")
|
114 |
+
with gr.Column():
|
115 |
+
prompt_template = gr.Dropdown(label="Set a custom insruction for the chatbot:", choices=list(prompt_templates.keys()))
|
116 |
+
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|
117 |
+
with gr.Accordion("Advanced parameters", open=False):
|
118 |
+
temperature = gr.Slider(minimum=0, maximum=2.0, value=0.7, step=0.1, label="Temperature", info="Higher = more creative/chaotic")
|
119 |
+
max_tokens = gr.Slider(minimum=100, maximum=4096, value=1000, step=1, label="Max tokens per response")
|
120 |
+
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.")
|
|
|
|
|
121 |
|
122 |
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>
|
123 |
<p><img src="https://visitor-badge.glitch.me/badge?page_id=anzorq.chatgpt_api_demo_hf" alt="visitors"></p></center>''')
|