vikhyatk commited on
Commit
f957cd9
·
verified ·
1 Parent(s): 38e37ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -122
app.py CHANGED
@@ -204,127 +204,6 @@ def point(img, object):
204
  visible=True, value=img
205
  )
206
 
207
-
208
- # js = """
209
- # function createBgAnimation() {
210
- # var canvas = document.createElement('canvas');
211
- # canvas.id = 'life-canvas';
212
- # document.body.appendChild(canvas);
213
-
214
- # var canvas = document.getElementById('life-canvas');
215
- # var ctx = canvas.getContext('2d');
216
-
217
- # function resizeCanvas() {
218
- # canvas.width = window.innerWidth;
219
- # canvas.height = window.innerHeight;
220
- # }
221
- # resizeCanvas();
222
- # window.addEventListener('resize', resizeCanvas);
223
-
224
- # var cellSize = 8;
225
- # var cols = Math.ceil(canvas.width / cellSize);
226
- # var rows = Math.ceil(canvas.height / cellSize);
227
-
228
- # // Track cell age for color variation
229
- # var grid = new Array(cols).fill(null)
230
- # .map(() => new Array(rows).fill(null)
231
- # .map(() => Math.random() > 0.8 ? 1 : 0)); // If alive, start with age 1
232
-
233
- # function countNeighbors(grid, x, y) {
234
- # var sum = 0;
235
- # for (var i = -1; i < 2; i++) {
236
- # for (var j = -1; j < 2; j++) {
237
- # var col = (x + i + cols) % cols;
238
- # var row = (y + j + rows) % rows;
239
- # sum += grid[col][row] ? 1 : 0;
240
- # }
241
- # }
242
- # sum -= grid[x][y] ? 1 : 0;
243
- # return sum;
244
- # }
245
-
246
- # function computeNextGeneration() {
247
- # var next = grid.map(arr => [...arr]);
248
-
249
- # for (var i = 0; i < cols; i++) {
250
- # for (var j = 0; j < rows; j++) {
251
- # var neighbors = countNeighbors(grid, i, j);
252
- # var state = grid[i][j];
253
-
254
- # if (state) {
255
- # if (neighbors < 2 || neighbors > 3) {
256
- # next[i][j] = 0; // Cell dies
257
- # } else {
258
- # next[i][j] = Math.min(state + 1, 5); // Age the cell, max age of 5
259
- # }
260
- # } else if (neighbors === 3) {
261
- # next[i][j] = 1; // New cell born
262
- # }
263
- # }
264
- # }
265
-
266
- # grid = next;
267
- # }
268
-
269
- # function getColor(age, isDarkMode) {
270
- # // Light mode colors
271
- # var lightColors = {
272
- # 1: '#dae1f5', // Light blue-grey
273
- # 2: '#d3e0f4',
274
- # 3: '#ccdff3',
275
- # 4: '#c5def2',
276
- # 5: '#beddf1' // Slightly deeper blue-grey
277
- # };
278
-
279
- # // Dark mode colors
280
- # var darkColors = {
281
- # /*
282
- # 1: '#4a5788', // Deep blue-grey
283
- # 2: '#4c5a8d',
284
- # 3: '#4e5d92',
285
- # 4: '#506097',
286
- # 5: '#52639c' // Brighter blue-grey
287
- # */
288
- # 1: 'rgb(16, 20, 32)',
289
- # 2: 'rgb(21, 25, 39)',
290
- # 3: 'rgb(26, 30, 46)',
291
- # 4: 'rgb(31, 35, 53)',
292
- # 5: 'rgb(36, 40, 60)'
293
- # };
294
-
295
- # return isDarkMode ? darkColors[age] : lightColors[age];
296
- # }
297
-
298
- # function draw() {
299
- # var isDarkMode = document.body.classList.contains('dark');
300
- # ctx.fillStyle = isDarkMode ? '#0b0f19' : '#f0f0f0';
301
- # ctx.fillRect(0, 0, canvas.width, canvas.height);
302
- # for (var i = 0; i < cols; i++) {
303
- # for (var j = 0; j < rows; j++) {
304
- # if (grid[i][j]) {
305
- # ctx.fillStyle = getColor(grid[i][j], isDarkMode);
306
- # ctx.fillRect(i * cellSize, j * cellSize, cellSize - 1, cellSize - 1);
307
- # }
308
- # }
309
- # }
310
- # }
311
-
312
- # var lastFrame = 0;
313
- # var frameInterval = 300;
314
-
315
- # function animate(timestamp) {
316
- # if (timestamp - lastFrame >= frameInterval) {
317
- # draw();
318
- # computeNextGeneration();
319
- # lastFrame = timestamp;
320
- # }
321
- # requestAnimationFrame(animate);
322
- # }
323
-
324
- # animate(0);
325
- # }
326
- # """
327
-
328
  js = ""
329
 
330
  css = """
@@ -366,7 +245,7 @@ with gr.Blocks(title="moondream vl (new)", css=css, js=js) as demo:
366
  """
367
  )
368
  mode_radio = gr.Radio(
369
- ["Caption", "Query", "Detect", "Point"],
370
  show_label=False,
371
  value=lambda: "Caption",
372
  )
 
204
  visible=True, value=img
205
  )
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  js = ""
208
 
209
  css = """
 
245
  """
246
  )
247
  mode_radio = gr.Radio(
248
+ ["Caption", "Query", "Detect", "Point", "Localized"],
249
  show_label=False,
250
  value=lambda: "Caption",
251
  )