Spaces:
Running
Running
Update index.html
Browse files- index.html +12 -12
index.html
CHANGED
@@ -9,31 +9,31 @@
|
|
9 |
<body>
|
10 |
<div class="card">
|
11 |
<h1>Wolfram Alpha Tool for HuggingFace Agents</h1>
|
12 |
-
<
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
<h1>Usage instructions:</h1>
|
17 |
-
<h3>
|
18 |
<code>
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
</code>
|
22 |
|
23 |
<h3>Test it:</h3>
|
24 |
<code>
|
25 |
-
|
26 |
-
wolframalpha_tool = WolframAlpha()<br>
|
27 |
print(wolframalpha_tool(query))<br>
|
28 |
</code>
|
29 |
|
30 |
<h3>Add tool to agent:</h3>
|
31 |
-
|
32 |
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=[wolframalpha_tool])
|
33 |
-
|
34 |
<h3>Ask the agent to solve some math:</h3>
|
35 |
<code>
|
36 |
-
|
37 |
print(res)<br>
|
38 |
<br>
|
39 |
res = agent.run("Integrate log(x)^2 + e^(x^2) dx")<br>
|
|
|
9 |
<body>
|
10 |
<div class="card">
|
11 |
<h1>Wolfram Alpha Tool for HuggingFace Agents</h1>
|
12 |
+
<h2>Demo Colab Notebook:</h2>
|
13 |
+
|
14 |
+
<a href="https://colab.research.google.com/drive/1wRv65uzfHO3WUJCo1tcRZgadq4XQ-o--">https://colab.research.google.com/drive/1wRv65uzfHO3WUJCo1tcRZgadq4XQ-o--</a><br>
|
|
|
15 |
<h1>Usage instructions:</h1>
|
16 |
+
<h3>Create and save WolframAlpha APP_ID as an environment variable:</h3>
|
17 |
<code>
|
18 |
+
os.environ["WOLFRAM_APP_ID"] = "YOUR_WOLFRAM_APP_ID"<br>
|
19 |
+
# Get it from: <a href="https://products.wolframalpha.com/simple-api/documentation">https://products.wolframalpha.com/simple-api/documentation</a><br>
|
20 |
+
from transformers import load_tool<br>
|
21 |
+
wolframalpha_tool = load_tool('LecJackS/wolfram-alpha-query')
|
22 |
</code>
|
23 |
|
24 |
<h3>Test it:</h3>
|
25 |
<code>
|
26 |
+
query = "Integrate [ log(x)^2 + e^(x^2) dx ]"<br>
|
|
|
27 |
print(wolframalpha_tool(query))<br>
|
28 |
</code>
|
29 |
|
30 |
<h3>Add tool to agent:</h3>
|
31 |
+
<code>
|
32 |
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=[wolframalpha_tool])
|
33 |
+
</code>
|
34 |
<h3>Ask the agent to solve some math:</h3>
|
35 |
<code>
|
36 |
+
res = agent.run("Solve the following equation: Area of circle of radius 2")<br>
|
37 |
print(res)<br>
|
38 |
<br>
|
39 |
res = agent.run("Integrate log(x)^2 + e^(x^2) dx")<br>
|