Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,10 @@ import os
|
|
7 |
# Function to process general math queries (basic and advanced)
|
8 |
def process_math(query):
|
9 |
try:
|
10 |
-
#
|
|
|
|
|
|
|
11 |
expr = sp.sympify(query)
|
12 |
|
13 |
# Evaluate the expression
|
|
|
7 |
# Function to process general math queries (basic and advanced)
|
8 |
def process_math(query):
|
9 |
try:
|
10 |
+
# Replace common shorthand input with valid sympy syntax
|
11 |
+
query = query.replace("factorial", "factorial(").replace("permutation", "permutation(").replace("combinations", "combinations(")
|
12 |
+
|
13 |
+
# Sympy can handle 'factorial(5)', 'permutation(5, 3)' etc.
|
14 |
expr = sp.sympify(query)
|
15 |
|
16 |
# Evaluate the expression
|