Spaces:
Running
Running
Commit
·
60fc52e
1
Parent(s):
6cbb33d
Update src/textdir2sql/loading.py
Browse files
src/textdir2sql/loading.py
CHANGED
|
@@ -12,7 +12,7 @@ BATCH_SIZE=1024
|
|
| 12 |
@click.argument('input_dir', type=click.Path(exists=True, file_okay=False, path_type=Path))
|
| 13 |
@click.argument('output', type=click.Path(dir_okay=False, writable=True, path_type=Path))
|
| 14 |
@click.option('--image-host', help="base URL of images")
|
| 15 |
-
@click.option('--explicit/--no-explicit', default=
|
| 16 |
def main(input_dir: Path, output: Path, image_host: str, explicit:bool):
|
| 17 |
connection = sqlite3.connect(output)
|
| 18 |
try:
|
|
@@ -20,7 +20,7 @@ def main(input_dir: Path, output: Path, image_host: str, explicit:bool):
|
|
| 20 |
finally:
|
| 21 |
connection.close()
|
| 22 |
|
| 23 |
-
def _main_with_connection(input_dir: Path, connection: sqlite3.Connection, image_host: str=None, explicit=
|
| 24 |
connection.execute("CREATE TABLE IF NOT EXISTS "
|
| 25 |
" captions(image_key text PRIMARY KEY, caption text NOT NULL);")
|
| 26 |
|
|
|
|
| 12 |
@click.argument('input_dir', type=click.Path(exists=True, file_okay=False, path_type=Path))
|
| 13 |
@click.argument('output', type=click.Path(dir_okay=False, writable=True, path_type=Path))
|
| 14 |
@click.option('--image-host', help="base URL of images")
|
| 15 |
+
@click.option('--explicit/--no-explicit', default=True)
|
| 16 |
def main(input_dir: Path, output: Path, image_host: str, explicit:bool):
|
| 17 |
connection = sqlite3.connect(output)
|
| 18 |
try:
|
|
|
|
| 20 |
finally:
|
| 21 |
connection.close()
|
| 22 |
|
| 23 |
+
def _main_with_connection(input_dir: Path, connection: sqlite3.Connection, image_host: str=None, explicit=True):
|
| 24 |
connection.execute("CREATE TABLE IF NOT EXISTS "
|
| 25 |
" captions(image_key text PRIMARY KEY, caption text NOT NULL);")
|
| 26 |
|