Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,13 +47,31 @@ with gr.Blocks() as demo:
|
|
| 47 |
btn.click(get_nth_frame, inputs=[input_video, input_n], outputs=output_img)
|
| 48 |
|
| 49 |
gr.Markdown("*****")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
|
|
|
|
|
|
| 51 |
def make_dataset(df):
|
| 52 |
path = os.path.dirname(__file__)
|
| 53 |
print("path:", path)
|
| 54 |
df.to_csv('label.csv')
|
| 55 |
return [ path+"/test.mp4", path+"/label.csv"]
|
| 56 |
-
|
| 57 |
with gr.Row():
|
| 58 |
df = gr.Dataframe(
|
| 59 |
headers=["start_index", "end_index", "label"],
|
|
@@ -61,13 +79,10 @@ with gr.Blocks() as demo:
|
|
| 61 |
row_count=0,
|
| 62 |
col_count=(3, "fixed"),
|
| 63 |
height=500,
|
| 64 |
-
interactive=True,
|
| 65 |
-
max_rows=None,
|
| 66 |
-
max_cols=None,
|
| 67 |
)
|
| 68 |
file = gr.File(file_count='multiple')
|
| 69 |
btn_make_dataset = gr.Button(value="make dataset")
|
| 70 |
-
btn_make_dataset.click(make_dataset, inputs=df, outputs=file)
|
| 71 |
|
| 72 |
gr.Markdown("*****")
|
| 73 |
gr.Examples([os.path.join(os.path.dirname(__file__), "test.mp4")], inputs=input_video)
|
|
|
|
| 47 |
btn.click(get_nth_frame, inputs=[input_video, input_n], outputs=output_img)
|
| 48 |
|
| 49 |
gr.Markdown("*****")
|
| 50 |
+
|
| 51 |
+
def add_textbox(tbs):
|
| 52 |
+
with gr.Row() as tmp:
|
| 53 |
+
gr.Textbox(lines=1, label="start")
|
| 54 |
+
gr.Textbox(lines=1, label="end")
|
| 55 |
+
gr.Textbox(lines=1, label="label")
|
| 56 |
+
tbs.append(tmp)
|
| 57 |
+
return tbs
|
| 58 |
+
|
| 59 |
+
with gr.Row():
|
| 60 |
+
tbs = []
|
| 61 |
+
file = gr.File(file_count='multiple')
|
| 62 |
+
with gr.Row():
|
| 63 |
+
btn_add_textbox = gr.Button(value="add")
|
| 64 |
+
btn_make_dataset = gr.Button(value="make dataset")
|
| 65 |
+
|
| 66 |
+
btn_add_textbox.click(make_dataset, inputs=tbs, outputs=tbs)
|
| 67 |
|
| 68 |
+
gr.Markdown("*****")
|
| 69 |
+
|
| 70 |
def make_dataset(df):
|
| 71 |
path = os.path.dirname(__file__)
|
| 72 |
print("path:", path)
|
| 73 |
df.to_csv('label.csv')
|
| 74 |
return [ path+"/test.mp4", path+"/label.csv"]
|
|
|
|
| 75 |
with gr.Row():
|
| 76 |
df = gr.Dataframe(
|
| 77 |
headers=["start_index", "end_index", "label"],
|
|
|
|
| 79 |
row_count=0,
|
| 80 |
col_count=(3, "fixed"),
|
| 81 |
height=500,
|
|
|
|
|
|
|
|
|
|
| 82 |
)
|
| 83 |
file = gr.File(file_count='multiple')
|
| 84 |
btn_make_dataset = gr.Button(value="make dataset")
|
| 85 |
+
btn_make_dataset.click(make_dataset, inputs=df, outputs=file)
|
| 86 |
|
| 87 |
gr.Markdown("*****")
|
| 88 |
gr.Examples([os.path.join(os.path.dirname(__file__), "test.mp4")], inputs=input_video)
|