Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -62,18 +62,6 @@ def safe_calculator_func(expression: str) -> str:
|
|
62 |
print(f"Error during calculation for '{expression}': {e}")
|
63 |
return f"Error calculating '{expression}': Invalid expression or calculation error ({e})."
|
64 |
|
65 |
-
# --- Custom Pipeline to Fix LangChain Integration ---
|
66 |
-
class FlanT5Pipeline(transformers.Pipeline):
|
67 |
-
def _call(self, *args, **kwargs):
|
68 |
-
# The HuggingFacePipeline class in LangChain might not pass the input
|
69 |
-
# with the 'inputs' keyword. This custom _call method ensures that
|
70 |
-
# whatever is passed as the first argument is correctly forwarded.
|
71 |
-
if args and len(args) > 0:
|
72 |
-
return super()._call(args[0], **kwargs)
|
73 |
-
else:
|
74 |
-
# Fallback in case no positional arguments are provided
|
75 |
-
return super()._call(kwargs)
|
76 |
-
|
77 |
class LangChainAgentWrapper:
|
78 |
def __init__(self):
|
79 |
print("Initializing LangChainAgentWrapper...")
|
|
|
62 |
print(f"Error during calculation for '{expression}': {e}")
|
63 |
return f"Error calculating '{expression}': Invalid expression or calculation error ({e})."
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
class LangChainAgentWrapper:
|
66 |
def __init__(self):
|
67 |
print("Initializing LangChainAgentWrapper...")
|