Spaces:
Sleeping
Sleeping
robert
commited on
Commit
·
b68dd3b
1
Parent(s):
bf8643c
Adding button to make sure models only get called once
Browse files
app.py
CHANGED
@@ -101,7 +101,7 @@ with gr.Blocks() as demo:
|
|
101 |
)
|
102 |
|
103 |
with gr.Row():
|
104 |
-
options = [
|
105 |
msg = gr.Dropdown(
|
106 |
options,
|
107 |
label="Please enter your message",
|
@@ -118,6 +118,9 @@ with gr.Blocks() as demo:
|
|
118 |
label="Your own fine-tuned preference optimized Chatbot 💪"
|
119 |
)
|
120 |
|
|
|
|
|
|
|
121 |
with gr.Row():
|
122 |
clear = gr.ClearButton([msg, chatbot_openai, chatbot_huggingface])
|
123 |
|
@@ -136,29 +139,7 @@ with gr.Blocks() as demo:
|
|
136 |
huggingface_api_key=huggingface_api_key,
|
137 |
)
|
138 |
|
139 |
-
|
140 |
-
fn=respond,
|
141 |
-
inputs=[
|
142 |
-
msg,
|
143 |
-
chatbot_openai,
|
144 |
-
chatbot_huggingface,
|
145 |
-
openai_api_key,
|
146 |
-
huggingface_api_key,
|
147 |
-
],
|
148 |
-
outputs=[msg, chatbot_openai, chatbot_huggingface],
|
149 |
-
)
|
150 |
-
huggingface_api_key.submit(
|
151 |
-
fn=respond,
|
152 |
-
inputs=[
|
153 |
-
msg,
|
154 |
-
chatbot_openai,
|
155 |
-
chatbot_huggingface,
|
156 |
-
openai_api_key,
|
157 |
-
huggingface_api_key,
|
158 |
-
],
|
159 |
-
outputs=[msg, chatbot_openai, chatbot_huggingface],
|
160 |
-
)
|
161 |
-
msg.change(
|
162 |
fn=respond,
|
163 |
inputs=[
|
164 |
msg,
|
|
|
101 |
)
|
102 |
|
103 |
with gr.Row():
|
104 |
+
options = [ask["history"] for ask in random.sample(ask_baking_msgs, k=3)]
|
105 |
msg = gr.Dropdown(
|
106 |
options,
|
107 |
label="Please enter your message",
|
|
|
118 |
label="Your own fine-tuned preference optimized Chatbot 💪"
|
119 |
)
|
120 |
|
121 |
+
with gr.Row():
|
122 |
+
submit_button = gr.Button("Submit")
|
123 |
+
|
124 |
with gr.Row():
|
125 |
clear = gr.ClearButton([msg, chatbot_openai, chatbot_huggingface])
|
126 |
|
|
|
139 |
huggingface_api_key=huggingface_api_key,
|
140 |
)
|
141 |
|
142 |
+
submit_button.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
fn=respond,
|
144 |
inputs=[
|
145 |
msg,
|