dailingx commited on
Commit
0507cca
Β·
verified Β·
1 Parent(s): 4000b93

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +7 -2
run.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  from huggingface.user import HFUser, GR_CONF
3
 
 
4
  Theme = gr.Theme.load(GR_CONF["theme"])
5
  GR_CONF["theme"] = Theme
6
  dataset_options = [
@@ -36,6 +37,10 @@ def split_parquet(u, file, batch_size):
36
  return file_slice[0][0], file_slice, gr.Slider(value=0, maximum=batch_size-1), gr.Column(visible=True)
37
 
38
  def select_video(chunks, epoch_idx , batch_idx):
 
 
 
 
39
  epoch_idx = int(epoch_idx)
40
  batch_idx = int(batch_idx)
41
  return chunks[epoch_idx][batch_idx]
@@ -70,7 +75,7 @@ with gr.Blocks(**GR_CONF) as Core:
70
  _list = gr.Button("List", variant='secondary', size='sm')
71
 
72
  with gr.Column(visible=False) as Batch:
73
- file = gr.Dropdown(label="Parquet")
74
  with gr.Row():
75
  _cache= gr.Textbox("Downloading", label="Cache")
76
  batch_size= gr.Textbox("8", label="Batch")
@@ -86,7 +91,7 @@ with gr.Blocks(**GR_CONF) as Core:
86
  submit = gr.Button("Submit", variant="primary", size="sm", scale=1)
87
  with gr.Row():
88
  rst = gr.Button("Reset", variant="stop", size="sm", scale=1)
89
- nxt = gr.Button("Next Batch", variant="secondary", size="sm", scale=1)
90
 
91
  _auth.click(fn=login, inputs=_token, outputs=[user, name, Auth])
92
  name.change(fn=show_time, inputs=[user, name], outputs=[time, Repo])
 
1
  import gradio as gr
2
  from huggingface.user import HFUser, GR_CONF
3
 
4
+
5
  Theme = gr.Theme.load(GR_CONF["theme"])
6
  GR_CONF["theme"] = Theme
7
  dataset_options = [
 
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]
 
75
  _list = gr.Button("List", variant='secondary', size='sm')
76
 
77
  with gr.Column(visible=False) as Batch:
78
+ file = gr.Dropdown(label="Parquet/MP4")
79
  with gr.Row():
80
  _cache= gr.Textbox("Downloading", label="Cache")
81
  batch_size= gr.Textbox("8", label="Batch")
 
91
  submit = gr.Button("Submit", variant="primary", size="sm", scale=1)
92
  with gr.Row():
93
  rst = gr.Button("Reset", variant="stop", size="sm", scale=1)
94
+ nxt = gr.Button("Next Batch/MP4", variant="secondary", size="sm", scale=1)
95
 
96
  _auth.click(fn=login, inputs=_token, outputs=[user, name, Auth])
97
  name.change(fn=show_time, inputs=[user, name], outputs=[time, Repo])