Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ def calculator(expression: str)-> str: # Returns a string result
|
|
| 21 |
str: The result of the calculation if successful, or an error message if the request fails.
|
| 22 |
"""
|
| 23 |
# URL-encode to ensure correct API interpretation
|
| 24 |
-
encoded_expression = urllib.parse.quote(expression, safe="")
|
| 25 |
|
| 26 |
try:
|
| 27 |
api_url = f"http://api.mathjs.org/v4/?expr={encoded_expression}"
|
|
@@ -55,8 +55,7 @@ final_answer = FinalAnswerTool()
|
|
| 55 |
model = HfApiModel(
|
| 56 |
max_tokens=2096,
|
| 57 |
temperature=0.5,
|
| 58 |
-
|
| 59 |
-
model_id='https://luht8fo5jxiffo7c.us-east4.gcp.endpoints.huggingface.cloud',# Replace with your inference endpoint
|
| 60 |
custom_role_conversions=None,
|
| 61 |
)
|
| 62 |
|
|
|
|
| 21 |
str: The result of the calculation if successful, or an error message if the request fails.
|
| 22 |
"""
|
| 23 |
# URL-encode to ensure correct API interpretation
|
| 24 |
+
encoded_expression = urllib.parse.quote(expression, safe="")
|
| 25 |
|
| 26 |
try:
|
| 27 |
api_url = f"http://api.mathjs.org/v4/?expr={encoded_expression}"
|
|
|
|
| 55 |
model = HfApiModel(
|
| 56 |
max_tokens=2096,
|
| 57 |
temperature=0.5,
|
| 58 |
+
model_id='replace_with_your_inference_endpoint', # Replace with your inference endpoint
|
|
|
|
| 59 |
custom_role_conversions=None,
|
| 60 |
)
|
| 61 |
|