Spaces:
Running
Running
First commit, usage instructions
Browse files- index.html +30 -6
index.html
CHANGED
|
@@ -8,12 +8,36 @@
|
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<div class="card">
|
| 11 |
-
<h1>
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
</div>
|
| 18 |
</body>
|
| 19 |
</html>
|
|
|
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<div class="card">
|
| 11 |
+
<h1>Wolfram Alpha Tool for HuggingFace Agents</h1>
|
| 12 |
+
<p>Not sure how to set this manually (push_to_hub does not seem to work for tool classes) so:</p>
|
| 13 |
+
<p> Copy the contents of:<p>
|
| 14 |
+
https://huggingface.co/spaces/LecJackS/wolfram-alpha-query/blob/main/wolfram-alpha-tool
|
| 15 |
+
|
| 16 |
+
<h1>Usage:</h1>
|
| 17 |
+
<code>
|
| 18 |
+
CFG_appid=<WOLFRAM API KEY>
|
| 19 |
+
# https://products.wolframalpha.com/simple-api/documentation
|
| 20 |
+
</code>
|
| 21 |
+
|
| 22 |
+
<h3>Test it:</h3>
|
| 23 |
+
<code>
|
| 24 |
+
query = "Integrate [ log(x)^2 + e^(x^2) dx ]"
|
| 25 |
+
wolframalpha_tool = WolframAlpha()
|
| 26 |
+
print(wolframalpha_tool(query))
|
| 27 |
+
</code>
|
| 28 |
+
|
| 29 |
+
<h3>Add tool to agent:</h3>
|
| 30 |
+
<code>
|
| 31 |
+
agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=[wolframalpha_tool])
|
| 32 |
+
</code>
|
| 33 |
+
<h3>Ask the agent to solve some math:</h3>
|
| 34 |
+
<code>
|
| 35 |
+
res = agent.run("Solve the following equation: Area of circle of radius 2")
|
| 36 |
+
print(res)
|
| 37 |
+
|
| 38 |
+
res = agent.run("Integrate log(x)^2 + e^(x^2) dx")
|
| 39 |
+
print(res)
|
| 40 |
+
</code>
|
| 41 |
</div>
|
| 42 |
</body>
|
| 43 |
</html>
|