da03 commited on
Commit
2004130
·
1 Parent(s): 552b730
Files changed (1) hide show
  1. static/index.html +108 -17
static/index.html CHANGED
@@ -3,47 +3,125 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Simulator</title>
 
 
7
  <style>
8
- /* Add this style rule to hide the cursor inside the canvas */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  #displayCanvas {
10
  cursor: none;
 
11
  }
12
 
13
- /* Add some styling for the controls */
14
  .controls {
15
- margin-top: 10px;
16
  display: flex;
17
- gap: 10px;
18
  align-items: center;
 
 
19
  }
20
 
21
  .control-button {
22
- padding: 5px 10px;
23
  cursor: pointer;
24
  }
25
 
26
  .step-control {
27
  display: flex;
28
  align-items: center;
29
- gap: 5px;
30
  }
31
 
32
  #samplingSteps {
33
- width: 60px;
 
 
 
 
 
34
  }
35
  </style>
36
  </head>
37
  <body>
38
- <canvas id="displayCanvas" width="512" height="384"></canvas>
39
-
40
- <div class="controls">
41
- <button id="resetButton" class="control-button">Reset Simulation</button>
 
 
 
 
 
42
 
43
- <div class="step-control">
44
- <label for="samplingSteps">Sampling Steps:</label>
45
- <input type="number" id="samplingSteps" min="1" max="100" value="32">
46
- <button id="updateStepsButton" class="control-button">Update</button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  </div>
48
  </div>
49
 
@@ -62,7 +140,8 @@
62
  let showTrace = false;
63
 
64
  function connect() {
65
- socket = new WebSocket(`wss://${window.location.host}/ws`);
 
66
 
67
  socket.onopen = function(event) {
68
  console.log("WebSocket connection established");
@@ -126,6 +205,15 @@
126
  // Initial connection
127
  connect();
128
 
 
 
 
 
 
 
 
 
 
129
  let lastSentPosition = null;
130
  let lastSentTime = 0;
131
  const SEND_INTERVAL = 10; // Send updates every 50ms
@@ -282,5 +370,8 @@
282
  }
283
  });
284
  </script>
 
 
 
285
  </body>
286
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>NeuralOS Demo</title>
7
+ <!-- Bootstrap CSS -->
8
+ <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
  <style>
10
+ body {
11
+ padding: 20px;
12
+ background-color: #f8f9fa;
13
+ }
14
+
15
+ .title-container {
16
+ text-align: center;
17
+ margin-bottom: 30px;
18
+ }
19
+
20
+ .canvas-container {
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ margin-bottom: 20px;
25
+ }
26
+
27
+ .canvas-wrapper {
28
+ position: relative;
29
+ border: 3px solid #007bff;
30
+ border-radius: 8px;
31
+ background-color: #f8f9fa;
32
+ margin-bottom: 15px;
33
+ }
34
+
35
+ .instruction-box {
36
+ position: absolute;
37
+ top: -40px;
38
+ left: 50%;
39
+ transform: translateX(-50%);
40
+ background-color: #007bff;
41
+ color: white;
42
+ padding: 5px 15px;
43
+ border-radius: 5px;
44
+ font-weight: bold;
45
+ white-space: nowrap;
46
+ }
47
+
48
  #displayCanvas {
49
  cursor: none;
50
+ display: block;
51
  }
52
 
 
53
  .controls {
54
+ margin-top: 20px;
55
  display: flex;
56
+ gap: 15px;
57
  align-items: center;
58
+ justify-content: center;
59
+ flex-wrap: wrap;
60
  }
61
 
62
  .control-button {
 
63
  cursor: pointer;
64
  }
65
 
66
  .step-control {
67
  display: flex;
68
  align-items: center;
69
+ gap: 10px;
70
  }
71
 
72
  #samplingSteps {
73
+ width: 70px;
74
+ }
75
+
76
+ .footer {
77
+ margin-top: 30px;
78
+ text-align: center;
79
  }
80
  </style>
81
  </head>
82
  <body>
83
+ <div class="container">
84
+ <div class="title-container">
85
+ <h1 class="mb-2">NeuralOS: Towards Simulating Operating Systems<br>via Neural Generative Models</h1>
86
+ <p class="mb-3">
87
+ <a href="https://anonymous.4open.science/r/neural-os" target="_blank" class="text-decoration-none">
88
+ Project Code: anonymous.4open.science/r/neural-os
89
+ </a>
90
+ </p>
91
+ </div>
92
 
93
+ <div class="canvas-container">
94
+ <div class="canvas-wrapper">
95
+ <div class="instruction-box">Move your mouse inside to interact</div>
96
+ <canvas id="displayCanvas" width="512" height="384"></canvas>
97
+ </div>
98
+
99
+ <div class="controls">
100
+ <button id="resetButton" class="btn btn-primary control-button">Reset Simulation</button>
101
+
102
+ <div class="step-control">
103
+ <label for="samplingSteps" class="form-label mb-0">Sampling Steps:</label>
104
+ <input type="number" id="samplingSteps" class="form-control" min="1" max="100" value="32">
105
+ <button id="updateStepsButton" class="btn btn-secondary control-button">Update</button>
106
+ </div>
107
+ </div>
108
+ </div>
109
+
110
+ <div class="row justify-content-center">
111
+ <div class="col-md-8">
112
+ <div class="card">
113
+ <div class="card-body">
114
+ <h5 class="card-title">Instructions:</h5>
115
+ <ul class="mb-0">
116
+ <li>Move your mouse inside the blue box to interact with NeuralOS</li>
117
+ <li>Click to perform left-click actions</li>
118
+ <li>Right-click to perform context menu actions</li>
119
+ <li>Use your keyboard to type within the simulated environment</li>
120
+ <li>Adjust sampling steps to control quality/speed tradeoff</li>
121
+ </ul>
122
+ </div>
123
+ </div>
124
+ </div>
125
  </div>
126
  </div>
127
 
 
140
  let showTrace = false;
141
 
142
  function connect() {
143
+ const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
144
+ socket = new WebSocket(`${protocol}//${window.location.host}/ws`);
145
 
146
  socket.onopen = function(event) {
147
  console.log("WebSocket connection established");
 
205
  // Initial connection
206
  connect();
207
 
208
+ // Draw initial state on the canvas
209
+ ctx.fillStyle = "#ffffff";
210
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
211
+ ctx.font = "18px Arial";
212
+ ctx.fillStyle = "#666666";
213
+ ctx.textAlign = "center";
214
+ ctx.fillText("Move your mouse here to interact with NeuralOS", canvas.width/2, canvas.height/2 - 10);
215
+ ctx.fillText("The neural model will render in this area", canvas.width/2, canvas.height/2 + 20);
216
+
217
  let lastSentPosition = null;
218
  let lastSentTime = 0;
219
  const SEND_INTERVAL = 10; // Send updates every 50ms
 
370
  }
371
  });
372
  </script>
373
+
374
+ <!-- Bootstrap JS (optional) -->
375
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
376
  </body>
377
  </html>