dailingx commited on
Commit
5df185e
·
verified ·
1 Parent(s): 0507cca

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +5 -3
run.py CHANGED
@@ -32,17 +32,19 @@ def split_parquet(u, file, batch_size):
32
  batch_size = int(batch_size)
33
  if file.lower().endswith(".mp4"):
34
  print(f"file is: {file}")
35
- return file, [file], gr.Slider(value=0, maximum=batch_size-1), gr.Column(visible=True)
36
  file_slice = u.split_parquet(file, batch_size)
37
  return file_slice[0][0], file_slice, gr.Slider(value=0, maximum=batch_size-1), gr.Column(visible=True)
38
 
39
  def select_video(chunks, epoch_idx , batch_idx):
40
  print(f"chunks: {chunks}, epoch_idx: {epoch_idx}, batch_idx: {batch_idx}")
41
  chunks_size = len(chunks)
42
- if epoch_idx >= chunks_size:
43
- return chunks[epoch_idx][batch_idx]
44
  epoch_idx = int(epoch_idx)
45
  batch_idx = int(batch_idx)
 
 
 
 
46
  return chunks[epoch_idx][batch_idx]
47
 
48
  def show_lables():
 
32
  batch_size = int(batch_size)
33
  if file.lower().endswith(".mp4"):
34
  print(f"file is: {file}")
35
+ return file, [[file]], gr.Slider(value=0, maximum=batch_size-1), gr.Column(visible=True)
36
  file_slice = u.split_parquet(file, batch_size)
37
  return file_slice[0][0], file_slice, gr.Slider(value=0, maximum=batch_size-1), gr.Column(visible=True)
38
 
39
  def select_video(chunks, epoch_idx , batch_idx):
40
  print(f"chunks: {chunks}, epoch_idx: {epoch_idx}, batch_idx: {batch_idx}")
41
  chunks_size = len(chunks)
 
 
42
  epoch_idx = int(epoch_idx)
43
  batch_idx = int(batch_idx)
44
+ if epoch_idx >= chunks_size:
45
+ epoch_idx = chunks_size-1
46
+ if batch_idx >= len(chunks[epoch_idx]):
47
+ batch_idx = len(chunks[epoch_idx])-1
48
  return chunks[epoch_idx][batch_idx]
49
 
50
  def show_lables():