initial commit
This commit is contained in:
14
backend/tools/math_transform.py
Normal file
14
backend/tools/math_transform.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from latex2sympy2 import latex2sympy
|
||||
|
||||
def generate_func(latex_input: str) -> function:
|
||||
latex_clean = latex_input.replace('\ ', '')
|
||||
res: str
|
||||
try:
|
||||
res = latex2sympy(latex_clean)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def func(input: dict):
|
||||
return eval(res)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user