Spaces:
Configuration error
Configuration error
Upload 3 files
Browse files
README.md
CHANGED
|
@@ -146,7 +146,7 @@ The result image also shows the detected bounding boxes and confidence values.
|
|
| 146 |
|
| 147 |
```text
|
| 148 |
Carnavalita
|
| 149 |
-
Kimo-
|
| 150 |
Squizz
|
| 151 |
Oreo
|
| 152 |
Moro
|
|
|
|
| 146 |
|
| 147 |
```text
|
| 148 |
Carnavalita
|
| 149 |
+
Kimo-COno
|
| 150 |
Squizz
|
| 151 |
Oreo
|
| 152 |
Moro
|
app.py
CHANGED
|
@@ -115,8 +115,13 @@ def upload_training_images(files):
|
|
| 115 |
saved = 0
|
| 116 |
skipped = []
|
| 117 |
for f in files:
|
| 118 |
-
path = Path(getattr(f, "path", getattr(f, "name", f)))
|
| 119 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
raw = path.read_bytes()
|
| 121 |
if len(raw) > MAX_IMAGE_MB * 1024 * 1024:
|
| 122 |
skipped.append(f"{path.name}: over {MAX_IMAGE_MB} MB")
|
|
@@ -406,7 +411,7 @@ with gr.Blocks(title="Ice Cream Dataset + Counter") as demo:
|
|
| 406 |
|
| 407 |
with gr.Tab("1 路 Dataset"):
|
| 408 |
gr.Markdown("### Upload training images")
|
| 409 |
-
files = gr.Files(file_count="multiple", file_types=["image"], label="Images")
|
| 410 |
upload_btn = gr.Button("Save Images", variant="primary")
|
| 411 |
upload_msg = gr.Markdown()
|
| 412 |
# Dataset selector
|
|
|
|
| 115 |
saved = 0
|
| 116 |
skipped = []
|
| 117 |
for f in files:
|
|
|
|
| 118 |
try:
|
| 119 |
+
# Gradio 6 may return FileData objects or plain dictionaries.
|
| 120 |
+
if isinstance(f, dict):
|
| 121 |
+
raw_path = f.get("path") or f.get("name") or f.get("filepath")
|
| 122 |
+
else:
|
| 123 |
+
raw_path = getattr(f, "path", None) or getattr(f, "name", None) or f
|
| 124 |
+
path = Path(raw_path)
|
| 125 |
raw = path.read_bytes()
|
| 126 |
if len(raw) > MAX_IMAGE_MB * 1024 * 1024:
|
| 127 |
skipped.append(f"{path.name}: over {MAX_IMAGE_MB} MB")
|
|
|
|
| 411 |
|
| 412 |
with gr.Tab("1 路 Dataset"):
|
| 413 |
gr.Markdown("### Upload training images")
|
| 414 |
+
files = gr.Files(file_count="multiple", file_types=["image"], type="filepath", label="Images")
|
| 415 |
upload_btn = gr.Button("Save Images", variant="primary")
|
| 416 |
upload_msg = gr.Markdown()
|
| 417 |
# Dataset selector
|