Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -80,6 +80,7 @@ def wolfram_alpha(query: str)-> str:
|
|
80 |
response.raise_for_status() # Raise an exception for HTTP errors
|
81 |
|
82 |
query_result = response.json().get("queryresult")
|
|
|
83 |
|
84 |
if query_result is None or query_result.get("error", False): # Check if there's an error in the response
|
85 |
print("Error 1")
|
@@ -87,13 +88,14 @@ def wolfram_alpha(query: str)-> str:
|
|
87 |
|
88 |
if pods := query_result.get("pods") is None:
|
89 |
print("Error 2")
|
|
|
90 |
return "Wolfram did not provide an answer."
|
91 |
|
92 |
print(f"{pods[0]}=")
|
93 |
return "; ".join(res.get("plaintext") for res in pods[0].get("subpods"))
|
94 |
|
95 |
-
except Exception: #requests.exceptions.RequestException as e:
|
96 |
-
|
97 |
# return f"Error fetching Wolfram response: {str(e)}"
|
98 |
|
99 |
|
|
|
80 |
response.raise_for_status() # Raise an exception for HTTP errors
|
81 |
|
82 |
query_result = response.json().get("queryresult")
|
83 |
+
print(f"{query_result=")
|
84 |
|
85 |
if query_result is None or query_result.get("error", False): # Check if there's an error in the response
|
86 |
print("Error 1")
|
|
|
88 |
|
89 |
if pods := query_result.get("pods") is None:
|
90 |
print("Error 2")
|
91 |
+
print(f"{pods}=")
|
92 |
return "Wolfram did not provide an answer."
|
93 |
|
94 |
print(f"{pods[0]}=")
|
95 |
return "; ".join(res.get("plaintext") for res in pods[0].get("subpods"))
|
96 |
|
97 |
+
except Exception as err: #requests.exceptions.RequestException as e:
|
98 |
+
print(Exception, err)
|
99 |
# return f"Error fetching Wolfram response: {str(e)}"
|
100 |
|
101 |
|