Spaces:
Runtime error
Runtime error
modularized app.py
Browse files- app.py +10 -107
- maths/algebra/{algebra_tabs.py → algebra_tab.py} +0 -0
- maths/arithmetic/arithmetic_tab.py +16 -0
- maths/calculus/calculus_tab.py +19 -0
- maths/differential_equations/differential_equations_tab.py +9 -0
- maths/equations/equations_tab.py +6 -0
- maths/geometry/geometry_tab.py +9 -0
- maths/matrices/matrices_tab.py +17 -0
- maths/number_theory/number_theory_tab.py +7 -0
- maths/operations_research/operations_research_tab.py +11 -0
- maths/vectors/vectors_tab.py +13 -0
app.py
CHANGED
@@ -1,111 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
-
from maths.arithmetic.
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
from maths.
|
8 |
-
from maths.
|
9 |
-
from maths.
|
10 |
-
|
11 |
-
|
12 |
-
from maths.calculus.calculus_interface import (
|
13 |
-
derivative_interface, integral_interface,
|
14 |
-
limit_interface, taylor_series_interface, fourier_series_interface, # Assuming these
|
15 |
-
partial_derivative_interface, multiple_integral_interface # Assuming these
|
16 |
-
)
|
17 |
-
|
18 |
-
from maths.matrices.matrices_interface import (
|
19 |
-
matrix_add_interface, matrix_subtract_interface, matrix_multiply_interface,
|
20 |
-
matrix_determinant_interface, matrix_inverse_interface
|
21 |
-
)
|
22 |
-
|
23 |
-
from maths.vectors.vectors_interface import (
|
24 |
-
vector_add_interface, vector_subtract_interface,
|
25 |
-
vector_dot_product_interface, vector_cross_product_interface
|
26 |
-
)
|
27 |
-
|
28 |
-
from maths.differential_equations.differential_equations_interface import (
|
29 |
-
first_order_ode_interface, second_order_ode_interface
|
30 |
-
)
|
31 |
-
from maths.operations_research.operations_research_interface import (
|
32 |
-
branch_and_bound_interface, dual_simplex_interface, simplex_solver_interface
|
33 |
-
)
|
34 |
-
from maths.equations.equations_interface import (
|
35 |
-
equations_app, solve_quadratic_interface # equations_app is the tabbed interface, solve_quadratic_interface for direct use
|
36 |
-
)
|
37 |
-
|
38 |
-
# Categorize interfaces by topics
|
39 |
-
|
40 |
-
arithmetic_interfaces_list = [
|
41 |
-
add_interface, subtract_interface, multiply_interface,
|
42 |
-
divide_interface, array_calc_interface, array_calc_vis_interface
|
43 |
-
]
|
44 |
-
arithmetic_tab_names = [
|
45 |
-
"Addition", "Subtraction", "Multiplication", "Division",
|
46 |
-
"Array Calculation", "Array Calculation Viz"
|
47 |
-
]
|
48 |
-
|
49 |
-
number_theory_interfaces_list = [gcd_interface, lcm_interface, is_prime_interface]
|
50 |
-
number_theory_tab_names = ["GCD", "LCM", "Prime Check"]
|
51 |
-
|
52 |
-
equations_interfaces_list = [
|
53 |
-
solve_linear_equation_interface, solve_quadratic_interface, # keep direct quadratic solver for single tab
|
54 |
-
solve_trig_equations_interface
|
55 |
-
]
|
56 |
-
equations_tab_names = [
|
57 |
-
"Linear Equation Solver", "Quadratic Solver",
|
58 |
-
"Trigonometric Equation Solver"
|
59 |
-
]
|
60 |
-
|
61 |
-
geometry_interfaces_list = [trig_interface, inverse_trig_interface, trig_identities_interface]
|
62 |
-
geometry_tab_names = ["Trig Functions", "Inverse Trig", "Trig Identities"]
|
63 |
-
|
64 |
-
calculus_interfaces_list = [
|
65 |
-
derivative_interface, integral_interface, limit_interface,
|
66 |
-
taylor_series_interface, fourier_series_interface,
|
67 |
-
partial_derivative_interface, multiple_integral_interface
|
68 |
-
]
|
69 |
-
calculus_tab_names = [
|
70 |
-
"Derivative", "Integral", "Limits",
|
71 |
-
"Taylor Series", "Fourier Series",
|
72 |
-
"Partial Derivatives", "Multiple Integrals"
|
73 |
-
]
|
74 |
-
|
75 |
-
differential_equations_interfaces_list = [first_order_ode_interface, second_order_ode_interface]
|
76 |
-
differential_equations_tab_names = ["First Order ODE", "Second Order ODE"]
|
77 |
-
|
78 |
-
matrices_interfaces_list = [
|
79 |
-
matrix_add_interface, matrix_subtract_interface,
|
80 |
-
matrix_multiply_interface, matrix_determinant_interface,
|
81 |
-
matrix_inverse_interface
|
82 |
-
]
|
83 |
-
matrices_tab_names = [
|
84 |
-
"Matrix Addition", "Matrix Subtraction", "Matrix Multiplication",
|
85 |
-
"Matrix Determinant", "Matrix Inverse"
|
86 |
-
]
|
87 |
-
|
88 |
-
vectors_interfaces_list = [
|
89 |
-
vector_add_interface, vector_subtract_interface,
|
90 |
-
vector_dot_product_interface, vector_cross_product_interface
|
91 |
-
]
|
92 |
-
vectors_tab_names = ["Vector Addition", "Vector Subtraction", "Dot Product", "Cross Product"]
|
93 |
-
|
94 |
-
operations_research_interfaces_list = [
|
95 |
-
branch_and_bound_interface, dual_simplex_interface, simplex_solver_interface
|
96 |
-
]
|
97 |
-
operations_research_tab_names = ["Branch & Bound", "Dual Simplex", "Simplex Steps"]
|
98 |
-
|
99 |
-
# Create topic-based tabbed interfaces
|
100 |
-
arithmetic_tab = gr.TabbedInterface(arithmetic_interfaces_list, arithmetic_tab_names, title="Arithmetic")
|
101 |
-
number_theory_tab = gr.TabbedInterface(number_theory_interfaces_list, number_theory_tab_names, title="Number Theory")
|
102 |
-
equations_tab = equations_app # Only include the composite equations_app in the equations tab to avoid duplicate Gradio blocks
|
103 |
-
geometry_tab = gr.TabbedInterface(geometry_interfaces_list, geometry_tab_names, title="Geometry")
|
104 |
-
calculus_tab = gr.TabbedInterface(calculus_interfaces_list, calculus_tab_names, title="Calculus")
|
105 |
-
differential_equations_tab = gr.TabbedInterface(differential_equations_interfaces_list, differential_equations_tab_names, title="Differential Equations")
|
106 |
-
matrices_tab = gr.TabbedInterface(matrices_interfaces_list, matrices_tab_names, title="Matrices")
|
107 |
-
vectors_tab = gr.TabbedInterface(vectors_interfaces_list, vectors_tab_names, title="Vectors")
|
108 |
-
operations_research_tab = gr.TabbedInterface(operations_research_interfaces_list, operations_research_tab_names, title="Operations Research")
|
109 |
|
110 |
# Main demo with topic tabs
|
111 |
demo = gr.TabbedInterface(
|
|
|
1 |
import gradio as gr
|
2 |
+
from maths.arithmetic.arithmetic_tab import arithmetic_tab
|
3 |
+
from maths.number_theory.number_theory_tab import number_theory_tab
|
4 |
+
from maths.algebra.algebra_tab import algebra_tab
|
5 |
+
from maths.equations.equations_tab import equations_tab
|
6 |
+
from maths.geometry.geometry_tab import geometry_tab
|
7 |
+
from maths.calculus.calculus_tab import calculus_tab
|
8 |
+
from maths.differential_equations.differential_equations_tab import differential_equations_tab
|
9 |
+
from maths.matrices.matrices_tab import matrices_tab
|
10 |
+
from maths.vectors.vectors_tab import vectors_tab
|
11 |
+
from maths.operations_research.operations_research_tab import operations_research_tab
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Main demo with topic tabs
|
14 |
demo = gr.TabbedInterface(
|
maths/algebra/{algebra_tabs.py → algebra_tab.py}
RENAMED
File without changes
|
maths/arithmetic/arithmetic_tab.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.arithmetic.arithmetic_interface import (
|
3 |
+
add_interface, subtract_interface, multiply_interface, divide_interface,
|
4 |
+
array_calc_interface, array_calc_vis_interface
|
5 |
+
)
|
6 |
+
|
7 |
+
arithmetic_interfaces_list = [
|
8 |
+
add_interface, subtract_interface, multiply_interface,
|
9 |
+
divide_interface, array_calc_interface, array_calc_vis_interface
|
10 |
+
]
|
11 |
+
arithmetic_tab_names = [
|
12 |
+
"Addition", "Subtraction", "Multiplication", "Division",
|
13 |
+
"Array Calculation", "Array Calculation Viz"
|
14 |
+
]
|
15 |
+
|
16 |
+
arithmetic_tab = gr.TabbedInterface(arithmetic_interfaces_list, arithmetic_tab_names, title="Arithmetic")
|
maths/calculus/calculus_tab.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.calculus.calculus_interface import (
|
3 |
+
derivative_interface, integral_interface,
|
4 |
+
limit_interface, taylor_series_interface, fourier_series_interface,
|
5 |
+
partial_derivative_interface, multiple_integral_interface
|
6 |
+
)
|
7 |
+
|
8 |
+
calculus_interfaces_list = [
|
9 |
+
derivative_interface, integral_interface, limit_interface,
|
10 |
+
taylor_series_interface, fourier_series_interface,
|
11 |
+
partial_derivative_interface, multiple_integral_interface
|
12 |
+
]
|
13 |
+
calculus_tab_names = [
|
14 |
+
"Derivative", "Integral", "Limits",
|
15 |
+
"Taylor Series", "Fourier Series",
|
16 |
+
"Partial Derivatives", "Multiple Integrals"
|
17 |
+
]
|
18 |
+
|
19 |
+
calculus_tab = gr.TabbedInterface(calculus_interfaces_list, calculus_tab_names, title="Calculus")
|
maths/differential_equations/differential_equations_tab.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.differential_equations.differential_equations_interface import (
|
3 |
+
first_order_ode_interface, second_order_ode_interface
|
4 |
+
)
|
5 |
+
|
6 |
+
differential_equations_interfaces_list = [first_order_ode_interface, second_order_ode_interface]
|
7 |
+
differential_equations_tab_names = ["First Order ODE", "Second Order ODE"]
|
8 |
+
|
9 |
+
differential_equations_tab = gr.TabbedInterface(differential_equations_interfaces_list, differential_equations_tab_names, title="Differential Equations")
|
maths/equations/equations_tab.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.equations.equations_interface import equations_app, solve_quadratic_interface
|
3 |
+
from maths.algebra.algebra_interface import solve_linear_equation_interface
|
4 |
+
from maths.geometry.trigonometry_interface import solve_trig_equations_interface
|
5 |
+
|
6 |
+
equations_tab = equations_app # Only include the composite equations_app in the equations tab to avoid duplicate Gradio blocks
|
maths/geometry/geometry_tab.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.geometry.trigonometry_interface import (
|
3 |
+
trig_interface, inverse_trig_interface, trig_identities_interface
|
4 |
+
)
|
5 |
+
|
6 |
+
geometry_interfaces_list = [trig_interface, inverse_trig_interface, trig_identities_interface]
|
7 |
+
geometry_tab_names = ["Trig Functions", "Inverse Trig", "Trig Identities"]
|
8 |
+
|
9 |
+
geometry_tab = gr.TabbedInterface(geometry_interfaces_list, geometry_tab_names, title="Geometry")
|
maths/matrices/matrices_tab.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.matrices.matrices_interface import (
|
3 |
+
matrix_add_interface, matrix_subtract_interface, matrix_multiply_interface,
|
4 |
+
matrix_determinant_interface, matrix_inverse_interface
|
5 |
+
)
|
6 |
+
|
7 |
+
matrices_interfaces_list = [
|
8 |
+
matrix_add_interface, matrix_subtract_interface,
|
9 |
+
matrix_multiply_interface, matrix_determinant_interface,
|
10 |
+
matrix_inverse_interface
|
11 |
+
]
|
12 |
+
matrices_tab_names = [
|
13 |
+
"Matrix Addition", "Matrix Subtraction", "Matrix Multiplication",
|
14 |
+
"Matrix Determinant", "Matrix Inverse"
|
15 |
+
]
|
16 |
+
|
17 |
+
matrices_tab = gr.TabbedInterface(matrices_interfaces_list, matrices_tab_names, title="Matrices")
|
maths/number_theory/number_theory_tab.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.arithmetic.arithmetic_interface import gcd_interface, lcm_interface, is_prime_interface
|
3 |
+
|
4 |
+
number_theory_interfaces_list = [gcd_interface, lcm_interface, is_prime_interface]
|
5 |
+
number_theory_tab_names = ["GCD", "LCM", "Prime Check"]
|
6 |
+
|
7 |
+
number_theory_tab = gr.TabbedInterface(number_theory_interfaces_list, number_theory_tab_names, title="Number Theory")
|
maths/operations_research/operations_research_tab.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.operations_research.operations_research_interface import (
|
3 |
+
branch_and_bound_interface, dual_simplex_interface, simplex_solver_interface
|
4 |
+
)
|
5 |
+
|
6 |
+
operations_research_interfaces_list = [
|
7 |
+
branch_and_bound_interface, dual_simplex_interface, simplex_solver_interface
|
8 |
+
]
|
9 |
+
operations_research_tab_names = ["Branch & Bound", "Dual Simplex", "Simplex Steps"]
|
10 |
+
|
11 |
+
operations_research_tab = gr.TabbedInterface(operations_research_interfaces_list, operations_research_tab_names, title="Operations Research")
|
maths/vectors/vectors_tab.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from maths.vectors.vectors_interface import (
|
3 |
+
vector_add_interface, vector_subtract_interface,
|
4 |
+
vector_dot_product_interface, vector_cross_product_interface
|
5 |
+
)
|
6 |
+
|
7 |
+
vectors_interfaces_list = [
|
8 |
+
vector_add_interface, vector_subtract_interface,
|
9 |
+
vector_dot_product_interface, vector_cross_product_interface
|
10 |
+
]
|
11 |
+
vectors_tab_names = ["Vector Addition", "Vector Subtraction", "Dot Product", "Cross Product"]
|
12 |
+
|
13 |
+
vectors_tab = gr.TabbedInterface(vectors_interfaces_list, vectors_tab_names, title="Vectors")
|