File size: 2,302 Bytes
628ab99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Basic Example with run model using Smolagents</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .container {
            display: flex;
            flex-wrap: wrap;
            min-height: 100vh;
        }

        .split-section {
            flex: 1 1 50%;
            padding: 2rem;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .left-section {
            background-color: #f0f0f0;
        }

        .right-section {
            background-color: #e0e0e0;
        }

        .content {
            max-width: 600px;
        }

        @media (max-width: 768px) {
            .split-section {
                flex-basis: 100%;
                min-height: 50vh;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="split-section left-section">
            <div class="content">
                <h2>Offline "smolagents" usage example:</h2>
                <p>from smolagents import CodeAgent, TransformersModel,DuckDuckGoSearchTool</p>
                <p>model_path = 'usr/Qwen3-4B-Instruct' #or 'C:/model/Qwen3-4B-Instruct' #(Path to model files usually .safetensors)</p>
                <p>model = TransformersModel(model_id=model_path,max_new_tokens=4096,device_map="auto")</p>
                <p>agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model) #offline #uses TransformersModel</p>
                <p>agent.run("Is it good today?")</p>
            </div>
        </div>
        





        <div class="split-section right-section">
            <div class="content">
                <h2>Online "smolagents" usage example:</h2>
                <p>from smolagents import CodeAgent, HfApiModel,DuckDuckGoSearchTool</p>
                <p>model_path = 'huihui-ai/Qwen3-4B-abliterated' #HFspace online</p>
                <p>agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel(model_path)) #online</p>
                <p>agent.run("Is it good today?")</p>
            </div>
        </div>
    </div>
</body>
</html>