Upload folder using huggingface_hub
Browse files- extend_dataset/script.py +8 -2
extend_dataset/script.py
CHANGED
|
@@ -104,10 +104,12 @@ class Pipeline:
|
|
| 104 |
self.console.print("[yellow]Warning: Could not determine dataset size. Using streaming mode.")
|
| 105 |
return None
|
| 106 |
|
| 107 |
-
|
| 108 |
-
def _load_config(yml_source: str) -> dict:
|
| 109 |
"""Load and parse YAML configuration from file or URL."""
|
| 110 |
if yml_source.startswith(('http://', 'https://')):
|
|
|
|
|
|
|
| 111 |
response = requests.get(yml_source)
|
| 112 |
response.raise_for_status()
|
| 113 |
return yaml.safe_load(response.text)
|
|
@@ -431,6 +433,10 @@ class Pipeline:
|
|
| 431 |
|
| 432 |
rprint(Panel("\n".join(summary)))
|
| 433 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 434 |
|
| 435 |
def main(
|
| 436 |
*,
|
|
|
|
| 104 |
self.console.print("[yellow]Warning: Could not determine dataset size. Using streaming mode.")
|
| 105 |
return None
|
| 106 |
|
| 107 |
+
|
| 108 |
+
def _load_config(self, yml_source: str) -> dict:
|
| 109 |
"""Load and parse YAML configuration from file or URL."""
|
| 110 |
if yml_source.startswith(('http://', 'https://')):
|
| 111 |
+
if self._is_sheets_dataset_url(yml_source):
|
| 112 |
+
yml_source = yml_source + '/json'
|
| 113 |
response = requests.get(yml_source)
|
| 114 |
response.raise_for_status()
|
| 115 |
return yaml.safe_load(response.text)
|
|
|
|
| 433 |
|
| 434 |
rprint(Panel("\n".join(summary)))
|
| 435 |
|
| 436 |
+
@staticmethod
|
| 437 |
+
def _is_sheets_dataset_url(url: str) -> bool:
|
| 438 |
+
"""Check if the URL points to a (AI)Sheets dataset."""
|
| 439 |
+
return "/home/dataset/" in url and "/json" not in url
|
| 440 |
|
| 441 |
def main(
|
| 442 |
*,
|