Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -70,20 +70,22 @@ def generate_response(user_message, max_tokens, temperature, top_k, top_p, repet
|
|
70 |
yield new_history, new_history
|
71 |
|
72 |
example_messages = {
|
73 |
-
"Math
|
74 |
-
"
|
75 |
-
"
|
76 |
}
|
77 |
|
78 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
79 |
gr.Markdown(
|
80 |
"""
|
81 |
# Phi-4-reasoning-plus Chatbot
|
82 |
-
Welcome to the Phi-4-reasoning-plus Chatbot! This model
|
83 |
-
1. **Thought section**: A detailed reasoning chain showing step-by-step analysis
|
84 |
-
2. **Solution section**: A concise, accurate final answer
|
85 |
|
86 |
-
|
|
|
|
|
|
|
|
|
87 |
"""
|
88 |
)
|
89 |
|
@@ -138,9 +140,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
138 |
clear_button = gr.Button("Clear", scale=1)
|
139 |
gr.Markdown("**Try these examples:**")
|
140 |
with gr.Row():
|
141 |
-
example1_button = gr.Button("Math
|
142 |
-
example2_button = gr.Button("
|
143 |
-
example3_button = gr.Button("
|
144 |
|
145 |
submit_button.click(
|
146 |
fn=generate_response,
|
@@ -159,17 +161,17 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
159 |
)
|
160 |
|
161 |
example1_button.click(
|
162 |
-
fn=lambda: gr.update(value=example_messages["Math
|
163 |
inputs=None,
|
164 |
outputs=user_input
|
165 |
)
|
166 |
example2_button.click(
|
167 |
-
fn=lambda: gr.update(value=example_messages["
|
168 |
inputs=None,
|
169 |
outputs=user_input
|
170 |
)
|
171 |
example3_button.click(
|
172 |
-
fn=lambda: gr.update(value=example_messages["
|
173 |
inputs=None,
|
174 |
outputs=user_input
|
175 |
)
|
|
|
70 |
yield new_history, new_history
|
71 |
|
72 |
example_messages = {
|
73 |
+
"Math reasoning": "If a rectangular prism has a length of 6 cm, a width of 4 cm, and a height of 5 cm, what is the length of the longest line segment that can be drawn from one vertex to another?",
|
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 |
+
"Physics problem": "A ball is thrown upward with an initial velocity of 15 m/s from a height of 2 meters above the ground. Assuming the acceleration due to gravity is 9.8 m/s², determine: 1) The maximum height the ball reaches. 2) The total time the ball is in the air before hitting the ground. 3) The velocity with which the ball hits the ground."
|
76 |
}
|
77 |
|
78 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
79 |
gr.Markdown(
|
80 |
"""
|
81 |
# Phi-4-reasoning-plus Chatbot
|
82 |
+
Welcome to the Phi-4-reasoning-plus Chatbot! This model excels at multi-step reasoning tasks in mathematics, logic, and science.
|
|
|
|
|
83 |
|
84 |
+
The model will provide responses with two sections:
|
85 |
+
1. **<think>**: A detailed step-by-step reasoning process showing its work
|
86 |
+
2. **Solution**: A concise, accurate final answer based on the reasoning
|
87 |
+
|
88 |
+
Try the example problems below to see how the model breaks down complex reasoning problems.
|
89 |
"""
|
90 |
)
|
91 |
|
|
|
140 |
clear_button = gr.Button("Clear", scale=1)
|
141 |
gr.Markdown("**Try these examples:**")
|
142 |
with gr.Row():
|
143 |
+
example1_button = gr.Button("Math reasoning")
|
144 |
+
example2_button = gr.Button("Logic puzzle")
|
145 |
+
example3_button = gr.Button("Physics problem")
|
146 |
|
147 |
submit_button.click(
|
148 |
fn=generate_response,
|
|
|
161 |
)
|
162 |
|
163 |
example1_button.click(
|
164 |
+
fn=lambda: gr.update(value=example_messages["Math reasoning"]),
|
165 |
inputs=None,
|
166 |
outputs=user_input
|
167 |
)
|
168 |
example2_button.click(
|
169 |
+
fn=lambda: gr.update(value=example_messages["Logic puzzle"]),
|
170 |
inputs=None,
|
171 |
outputs=user_input
|
172 |
)
|
173 |
example3_button.click(
|
174 |
+
fn=lambda: gr.update(value=example_messages["Physics problem"]),
|
175 |
inputs=None,
|
176 |
outputs=user_input
|
177 |
)
|