Add files
Browse files
app.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
| 1 |
import os
|
| 2 |
-
import sys
|
| 3 |
import threading
|
| 4 |
import queue
|
| 5 |
import time
|
| 6 |
import tempfile
|
| 7 |
import shutil
|
| 8 |
from contextlib import redirect_stdout, redirect_stderr
|
| 9 |
-
from typing import List
|
| 10 |
|
| 11 |
import gradio as gr
|
| 12 |
from huggingface_hub import HfApi
|
|
@@ -189,67 +188,67 @@ with gr.Blocks(title="LeRobot Episode Deleter", theme=gr.themes.Soft()) as demo:
|
|
| 189 |
"Delete specific episodes from a HuggingFace LeRobot dataset and upload the cleaned version."
|
| 190 |
)
|
| 191 |
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
|
| 254 |
# Event handlers
|
| 255 |
def update_search_results(query):
|
|
|
|
| 1 |
import os
|
|
|
|
| 2 |
import threading
|
| 3 |
import queue
|
| 4 |
import time
|
| 5 |
import tempfile
|
| 6 |
import shutil
|
| 7 |
from contextlib import redirect_stdout, redirect_stderr
|
| 8 |
+
from typing import List
|
| 9 |
|
| 10 |
import gradio as gr
|
| 11 |
from huggingface_hub import HfApi
|
|
|
|
| 188 |
"Delete specific episodes from a HuggingFace LeRobot dataset and upload the cleaned version."
|
| 189 |
)
|
| 190 |
|
| 191 |
+
# Load initial datasets
|
| 192 |
+
_initial_choices = search_datasets_fn("griffinlabs-cortex")
|
| 193 |
+
|
| 194 |
+
with gr.Row():
|
| 195 |
+
search_box = gr.Textbox(
|
| 196 |
+
label="Search Datasets (optional)",
|
| 197 |
+
placeholder="Enter keyword or organization name (e.g., 'lerobot', 'griffinlabs-cortex')",
|
| 198 |
+
value="griffinlabs-cortex"
|
| 199 |
+
)
|
| 200 |
+
search_btn = gr.Button("π Search")
|
| 201 |
+
|
| 202 |
+
with gr.Row():
|
| 203 |
+
dataset_dropdown = gr.Dropdown(
|
| 204 |
+
label="Select Dataset",
|
| 205 |
+
choices=_initial_choices,
|
| 206 |
+
interactive=True,
|
| 207 |
+
allow_custom_value=True,
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
with gr.Row():
|
| 211 |
+
download_btn = gr.Button("π₯ Download & List Episodes", variant="secondary", size="lg")
|
| 212 |
+
|
| 213 |
+
download_status = gr.Textbox(
|
| 214 |
+
label="Status",
|
| 215 |
+
lines=2,
|
| 216 |
+
interactive=False,
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
gr.Markdown("---")
|
| 220 |
+
gr.Markdown("### Select Episodes to Delete")
|
| 221 |
+
|
| 222 |
+
episodes_selector = gr.CheckboxGroup(
|
| 223 |
+
label="Episodes (select to delete)",
|
| 224 |
+
choices=[],
|
| 225 |
+
interactive=True,
|
| 226 |
+
)
|
| 227 |
+
|
| 228 |
+
selected_count = gr.Markdown("*No episodes selected*")
|
| 229 |
+
|
| 230 |
+
gr.Markdown("---")
|
| 231 |
+
gr.Markdown("### Configure Destination & Execute")
|
| 232 |
+
|
| 233 |
+
dest_repo_input = gr.Textbox(
|
| 234 |
+
label="Destination Repository ID",
|
| 235 |
+
placeholder="your-org/cleaned-dataset",
|
| 236 |
+
info="The HuggingFace repo where the cleaned dataset will be uploaded"
|
| 237 |
+
)
|
| 238 |
+
|
| 239 |
+
with gr.Row():
|
| 240 |
+
execute_btn = gr.Button(
|
| 241 |
+
"π Delete Episodes & Upload",
|
| 242 |
+
variant="primary",
|
| 243 |
+
size="lg",
|
| 244 |
+
)
|
| 245 |
+
|
| 246 |
+
progress_log = gr.Textbox(
|
| 247 |
+
label="Progress Log",
|
| 248 |
+
lines=20,
|
| 249 |
+
interactive=False,
|
| 250 |
+
max_lines=25,
|
| 251 |
+
)
|
| 252 |
|
| 253 |
# Event handlers
|
| 254 |
def update_search_results(query):
|