Full example with run
Browse files- index.html +77 -19
index.html
CHANGED
@@ -1,19 +1,77 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Basic Example with run model using Smolagents</title>
|
7 |
+
<style>
|
8 |
+
* {
|
9 |
+
margin: 0;
|
10 |
+
padding: 0;
|
11 |
+
box-sizing: border-box;
|
12 |
+
}
|
13 |
+
|
14 |
+
.container {
|
15 |
+
display: flex;
|
16 |
+
flex-wrap: wrap;
|
17 |
+
min-height: 100vh;
|
18 |
+
}
|
19 |
+
|
20 |
+
.split-section {
|
21 |
+
flex: 1 1 50%;
|
22 |
+
padding: 2rem;
|
23 |
+
display: flex;
|
24 |
+
align-items: center;
|
25 |
+
justify-content: center;
|
26 |
+
}
|
27 |
+
|
28 |
+
.left-section {
|
29 |
+
background-color: #f0f0f0;
|
30 |
+
}
|
31 |
+
|
32 |
+
.right-section {
|
33 |
+
background-color: #e0e0e0;
|
34 |
+
}
|
35 |
+
|
36 |
+
.content {
|
37 |
+
max-width: 600px;
|
38 |
+
}
|
39 |
+
|
40 |
+
@media (max-width: 768px) {
|
41 |
+
.split-section {
|
42 |
+
flex-basis: 100%;
|
43 |
+
min-height: 50vh;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
</style>
|
47 |
+
</head>
|
48 |
+
<body>
|
49 |
+
<div class="container">
|
50 |
+
<div class="split-section left-section">
|
51 |
+
<div class="content">
|
52 |
+
<h2>Offline "smolagents" usage example:</h2>
|
53 |
+
<p>from smolagents import CodeAgent, TransformersModel,DuckDuckGoSearchTool</p>
|
54 |
+
<p>model_path = 'usr/Qwen3-4B-Instruct' #or 'C:/model/Qwen3-4B-Instruct' #(Path to model files usually .safetensors)</p>
|
55 |
+
<p>model = TransformersModel(model_id=model_path,max_new_tokens=4096,device_map="auto")</p>
|
56 |
+
<p>agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model) #offline #uses TransformersModel</p>
|
57 |
+
<p>agent.run("Is it good today?")</p>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
<div class="split-section right-section">
|
67 |
+
<div class="content">
|
68 |
+
<h2>Online "smolagents" usage example:</h2>
|
69 |
+
<p>from smolagents import CodeAgent, HfApiModel,DuckDuckGoSearchTool</p>
|
70 |
+
<p>model_path = 'huihui-ai/Qwen3-4B-abliterated' #HFspace online</p>
|
71 |
+
<p>agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel(model_path)) #online</p>
|
72 |
+
<p>agent.run("Is it good today?")</p>
|
73 |
+
</div>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
</body>
|
77 |
+
</html>
|