openfree commited on
Commit
316476b
·
verified ·
1 Parent(s): 493d47c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
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 problem": "Solve for x: 3x^2 + 6x - 9 = 0",
74
- "Algorithmic task": "Write a Python function to find the longest common subsequence of two strings.",
75
- "Reasoning puzzle": "There are 5 houses in a row, each with a different color. The person in each house has a different nationality, pet, drink, and cigarette brand. Given that: The Brit lives in the red house. The Swede keeps dogs. The Dane drinks tea. The green house is on the left of the white house. The green house owner drinks coffee. The person who smokes Pall Mall keeps birds. The owner of the yellow house smokes Dunhill. The man living in the center house drinks milk. The Norwegian lives in the first house. The man who smokes Blend lives next to the one who keeps cats. The man who keeps horses lives next to the man who smokes Dunhill. The owner who smokes Blue Master drinks beer. The German smokes Prince. The Norwegian lives next to the blue house. The man who smokes Blend has a neighbor who drinks water. Who owns the fish?"
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 is designed for advanced reasoning tasks and structured thinking. The model will provide responses with two sections:
83
- 1. **Thought section**: A detailed reasoning chain showing step-by-step analysis
84
- 2. **Solution section**: A concise, accurate final answer
85
 
86
- Adjust the settings on the left to customize the model's responses. For complex queries, consider increasing the max tokens.
 
 
 
 
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 problem")
142
- example2_button = gr.Button("Algorithmic task")
143
- example3_button = gr.Button("Reasoning puzzle")
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 problem"]),
163
  inputs=None,
164
  outputs=user_input
165
  )
166
  example2_button.click(
167
- fn=lambda: gr.update(value=example_messages["Algorithmic task"]),
168
  inputs=None,
169
  outputs=user_input
170
  )
171
  example3_button.click(
172
- fn=lambda: gr.update(value=example_messages["Reasoning puzzle"]),
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
  )