Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ from Gradio_UI import GradioUI
|
|
| 11 |
@tool
|
| 12 |
def calculator(expression: str)-> str: # Returns a string result
|
| 13 |
"""
|
| 14 |
-
A tool able to solve mathematical expressions using the
|
| 15 |
|
| 16 |
Args:
|
| 17 |
expression: A mathematical expression to solve (e.g., "1+2", "3*5").
|
|
@@ -22,9 +22,7 @@ def calculator(expression: str)-> str: # Returns a string result
|
|
| 22 |
# Remove spaces
|
| 23 |
expression = expression.replace(" ","")
|
| 24 |
try:
|
| 25 |
-
|
| 26 |
-
app_id = "963LYK-E4A8XXUHW4" # Your Wolfram Alpha App ID
|
| 27 |
-
api_url = f"https://api.wolframalpha.com/v1/result?appid={app_id}&i={expression}"
|
| 28 |
|
| 29 |
response = requests.get(api_url)
|
| 30 |
|
|
|
|
| 11 |
@tool
|
| 12 |
def calculator(expression: str)-> str: # Returns a string result
|
| 13 |
"""
|
| 14 |
+
A tool able to solve mathematical expressions using the mathjs.org
|
| 15 |
|
| 16 |
Args:
|
| 17 |
expression: A mathematical expression to solve (e.g., "1+2", "3*5").
|
|
|
|
| 22 |
# Remove spaces
|
| 23 |
expression = expression.replace(" ","")
|
| 24 |
try:
|
| 25 |
+
api_url = f"http://api.mathjs.org/v4/?expr={expression}"
|
|
|
|
|
|
|
| 26 |
|
| 27 |
response = requests.get(api_url)
|
| 28 |
|