XMMR12 commited on
Commit
628ab99
·
verified ·
1 Parent(s): 92a37e2

Full example with run

Browse files
Files changed (1) hide show
  1. index.html +77 -19
index.html CHANGED
@@ -1,19 +1,77 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>