mcamargo00 commited on
Commit
78a5bd6
·
verified ·
1 Parent(s): 29f7da4

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -10
app.py CHANGED
@@ -730,6 +730,10 @@ with gr.Blocks(title="Math Solution Classifier", theme=gr.themes.Soft()) as app:
730
  placeholder="e.g., 2x + 5 = 13\n2x = 13 - 5\n2x = 8\nx = 4",
731
  lines=8,
732
  )
 
 
 
 
733
  with gr.Row():
734
  classify_btn = gr.Button("Classify Solution", variant="primary")
735
  surprise_btn = gr.Button("Surprise me") # <- new
@@ -745,23 +749,28 @@ with gr.Blocks(title="Math Solution Classifier", theme=gr.themes.Soft()) as app:
745
  gr.Examples(
746
  examples=[
747
  ["John has three apples and Mary has seven, how many apples do they have together?",
748
- "They have 7 + 3 = 11 apples."],
 
749
  ["A rectangle's length is twice its width. If the width is 7 cm, what is the perimeter of the rectangle?",
750
- "The length of the rectangle is 2 * 7 = 14 cm.\n The perimeter is 14 + 7 = 21 cm.\n FINAL ANSWER: 21"],
751
- ["John has three apples and Mary has seven, how many apples do they have together?",
752
- "They have 7 + 3 = 11 apples."],
753
  ["A tank holds 60 liters of fuel. A generator uses fuel at a rate of 5 liters per hour. After running for 9 hours, how many liters are still in the tank?",
754
- "The generator uses 5 L/h × 9 h = 45 L of fuel in 9 hours.\n Then, there remain 60 L + 45 L = 105 L in the tank.\n Final answer: 105 L"],
 
755
  ["What is 15% of 200?",
756
- "15% = 15/100 = 0.15\n0.15 × 200 = 30"],
 
757
  ["A circle has a radius of 5 cm. Using the approximation pi = 3.14, what is the circumference of the circle?",
758
- "The circumference of the circle is 3.14 * 5 = 15.7 cm.\n FINAL ANSWER: 15.7"],
 
759
  ["A bag contains red and blue balls. The ratio of red balls to blue balls is 4:5. If there are 20 blue balls, how many red balls are there?",
760
- "The ratio R/B = 4/5. With B=20, we have R/20 = 4/5.\n Solving for R gives R = (4/5) * 20 = 16 red balls.\n FINAL ANSWER: 16"],
 
761
  ["A 24-meter rope is cut into 6 equal pieces. A climber uses 2 of those pieces. How many meters of rope are still unused?",
762
- "The length of each piece is 24 / 6 = 4 m.\n The climber uses 2 × 4 m = 8 m of rope.\n There are 24 m − 8 m = 16 m of rope still unused."]
 
763
  ],
764
- inputs=[question_input, solution_input],
765
  )
766
 
767
 
 
730
  placeholder="e.g., 2x + 5 = 13\n2x = 13 - 5\n2x = 8\nx = 4",
731
  lines=8,
732
  )
733
+ expected_label_example = gr.Textbox(
734
+ label="Expected Label (examples only)",
735
+ visible=False
736
+ )
737
  with gr.Row():
738
  classify_btn = gr.Button("Classify Solution", variant="primary")
739
  surprise_btn = gr.Button("Surprise me") # <- new
 
749
  gr.Examples(
750
  examples=[
751
  ["John has three apples and Mary has seven, how many apples do they have together?",
752
+ "They have 7 + 3 = 11 apples.",
753
+ "Computational error"],
754
  ["A rectangle's length is twice its width. If the width is 7 cm, what is the perimeter of the rectangle?",
755
+ "The length of the rectangle is 2 * 7 = 14 cm.\n The perimeter is 14 + 7 = 21 cm.\n FINAL ANSWER: 21",
756
+ "x"],
 
757
  ["A tank holds 60 liters of fuel. A generator uses fuel at a rate of 5 liters per hour. After running for 9 hours, how many liters are still in the tank?",
758
+ "The generator uses 5 L/h × 9 h = 45 L of fuel in 9 hours.\n Then, there remain 60 L + 45 L = 105 L in the tank.\n Final answer: 105 L",
759
+ "x"],
760
  ["What is 15% of 200?",
761
+ "15% = 15/100 = 0.15\n0.15 × 200 = 30",
762
+ "x"],
763
  ["A circle has a radius of 5 cm. Using the approximation pi = 3.14, what is the circumference of the circle?",
764
+ "The circumference of the circle is 3.14 * 5 = 15.7 cm.\n FINAL ANSWER: 15.7",
765
+ "x"],
766
  ["A bag contains red and blue balls. The ratio of red balls to blue balls is 4:5. If there are 20 blue balls, how many red balls are there?",
767
+ "The ratio R/B = 4/5. With B=20, we have R/20 = 4/5.\n Solving for R gives R = (4/5) * 20 = 16 red balls.\n FINAL ANSWER: 16",
768
+ "x"],
769
  ["A 24-meter rope is cut into 6 equal pieces. A climber uses 2 of those pieces. How many meters of rope are still unused?",
770
+ "The length of each piece is 24 / 6 = 4 m.\n The climber uses 2 × 4 m = 8 m of rope.\n There are 24 m − 8 m = 16 m of rope still unused.",
771
+ "x"]
772
  ],
773
+ inputs=[question_input, solution_input, expected_label_example],
774
  )
775
 
776