Spaces:
Runtime error
Runtime error
Update certificate_upload_module.py
Browse files
certificate_upload_module.py
CHANGED
|
@@ -2,7 +2,7 @@ import tempfile
|
|
| 2 |
import time
|
| 3 |
import logging
|
| 4 |
from PIL import Image as PILImage
|
| 5 |
-
from datasets import Dataset, Image
|
| 6 |
from huggingface_hub import HfApi, login
|
| 7 |
import pandas as pd
|
| 8 |
import os
|
|
@@ -12,7 +12,6 @@ from datetime import datetime
|
|
| 12 |
logging.basicConfig(level=logging.INFO)
|
| 13 |
logger = logging.getLogger(__name__)
|
| 14 |
|
| 15 |
-
# Replace with your actual certificate dataset name
|
| 16 |
CERTIFICATE_DATASET_NAME = "ysharma/gradio-agents-mcp-hackathon-certificates"
|
| 17 |
|
| 18 |
def safe_add_certificate_to_dataset(certificate_image, hf_username, max_retries=5, retry_delay=3):
|
|
@@ -118,7 +117,8 @@ def safe_add_certificate_to_dataset(certificate_image, hf_username, max_retries=
|
|
| 118 |
# Combine with existing dataset or use new dataset if empty
|
| 119 |
if existing_dataset is not None and not is_empty_dataset:
|
| 120 |
try:
|
| 121 |
-
combined_dataset = existing_dataset.concatenate_datasets([new_dataset])
|
|
|
|
| 122 |
logger.info(f"Combined dataset now has {len(combined_dataset)} certificates (was {len(existing_dataset)})")
|
| 123 |
except Exception as concat_error:
|
| 124 |
logger.error(f"Failed to combine datasets: {concat_error}")
|
|
|
|
| 2 |
import time
|
| 3 |
import logging
|
| 4 |
from PIL import Image as PILImage
|
| 5 |
+
from datasets import Dataset, Image, concatenate_datasets
|
| 6 |
from huggingface_hub import HfApi, login
|
| 7 |
import pandas as pd
|
| 8 |
import os
|
|
|
|
| 12 |
logging.basicConfig(level=logging.INFO)
|
| 13 |
logger = logging.getLogger(__name__)
|
| 14 |
|
|
|
|
| 15 |
CERTIFICATE_DATASET_NAME = "ysharma/gradio-agents-mcp-hackathon-certificates"
|
| 16 |
|
| 17 |
def safe_add_certificate_to_dataset(certificate_image, hf_username, max_retries=5, retry_delay=3):
|
|
|
|
| 117 |
# Combine with existing dataset or use new dataset if empty
|
| 118 |
if existing_dataset is not None and not is_empty_dataset:
|
| 119 |
try:
|
| 120 |
+
#combined_dataset = existing_dataset.concatenate_datasets([new_dataset])
|
| 121 |
+
combined_dataset = concatenate_datasets([existing_dataset, new_dataset])
|
| 122 |
logger.info(f"Combined dataset now has {len(combined_dataset)} certificates (was {len(existing_dataset)})")
|
| 123 |
except Exception as concat_error:
|
| 124 |
logger.error(f"Failed to combine datasets: {concat_error}")
|