Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -69,9 +69,11 @@ def generate_response(user_message, max_tokens, temperature, top_k, top_p, repet
|
|
69 |
|
70 |
yield new_history, new_history
|
71 |
|
|
|
72 |
example_messages = {
|
73 |
-
"
|
74 |
"Logic puzzle": "Four people (Alex, Blake, Casey, and Dana) each have a different favorite color (red, blue, green, yellow) and a different favorite fruit (apple, banana, cherry, date). Given the following clues: 1) The person who likes red doesn't like dates. 2) Alex likes yellow. 3) The person who likes blue likes cherries. 4) Blake doesn't like apples or bananas. 5) Casey doesn't like yellow or green. Who likes what color and what fruit?",
|
|
|
75 |
}
|
76 |
|
77 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
@@ -140,6 +142,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
140 |
with gr.Row():
|
141 |
example1_button = gr.Button("Math reasoning")
|
142 |
example2_button = gr.Button("Logic puzzle")
|
|
|
143 |
|
144 |
submit_button.click(
|
145 |
fn=generate_response,
|
@@ -157,6 +160,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
157 |
outputs=[chatbot, history_state]
|
158 |
)
|
159 |
|
|
|
160 |
example1_button.click(
|
161 |
fn=lambda: gr.update(value=example_messages["Math reasoning"]),
|
162 |
inputs=None,
|
@@ -167,5 +171,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
167 |
inputs=None,
|
168 |
outputs=user_input
|
169 |
)
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
demo.launch(ssr_mode=False, share=True)
|
|
|
69 |
|
70 |
yield new_history, new_history
|
71 |
|
72 |
+
# Fixed: Match the keys with your button labels
|
73 |
example_messages = {
|
74 |
+
"Math reasoning": "Calculate the sum of the first 10 prime numbers and explain your reasoning step by step.",
|
75 |
"Logic puzzle": "Four people (Alex, Blake, Casey, and Dana) each have a different favorite color (red, blue, green, yellow) and a different favorite fruit (apple, banana, cherry, date). Given the following clues: 1) The person who likes red doesn't like dates. 2) Alex likes yellow. 3) The person who likes blue likes cherries. 4) Blake doesn't like apples or bananas. 5) Casey doesn't like yellow or green. Who likes what color and what fruit?",
|
76 |
+
"Verilog example": "Design a 4-bit adder circuit in Verilog with proper test benches."
|
77 |
}
|
78 |
|
79 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
142 |
with gr.Row():
|
143 |
example1_button = gr.Button("Math reasoning")
|
144 |
example2_button = gr.Button("Logic puzzle")
|
145 |
+
example3_button = gr.Button("Verilog example")
|
146 |
|
147 |
submit_button.click(
|
148 |
fn=generate_response,
|
|
|
160 |
outputs=[chatbot, history_state]
|
161 |
)
|
162 |
|
163 |
+
# Fixed: Now these will work without KeyError
|
164 |
example1_button.click(
|
165 |
fn=lambda: gr.update(value=example_messages["Math reasoning"]),
|
166 |
inputs=None,
|
|
|
171 |
inputs=None,
|
172 |
outputs=user_input
|
173 |
)
|
174 |
+
example3_button.click(
|
175 |
+
fn=lambda: gr.update(value=example_messages["Verilog example"]),
|
176 |
+
inputs=None,
|
177 |
+
outputs=user_input
|
178 |
+
)
|
179 |
|
180 |
demo.launch(ssr_mode=False, share=True)
|