Browse Source
update readme
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
main
1 changed files with
9 additions and
5 deletions
-
README.md
|
@ -18,6 +18,7 @@ Read data from sqlite or mysql. |
|
|
### Example |
|
|
### Example |
|
|
|
|
|
|
|
|
```python |
|
|
```python |
|
|
|
|
|
|
|
|
from towhee import DataLoader, pipe, ops |
|
|
from towhee import DataLoader, pipe, ops |
|
|
p = ( |
|
|
p = ( |
|
|
pipe.input('image_path') |
|
|
pipe.input('image_path') |
|
@ -27,11 +28,14 @@ p = ( |
|
|
|
|
|
|
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
for data in DataLoader(ops.data_source.sql('sqlite:///./sqlite.db')): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# table cols: id, image_path, label |
|
|
|
|
|
|
|
|
|
|
|
for data in DataLoader(ops.data_source.sql('sqlite:///./sqlite.db', 'image_table'), parser=lambda x: x[1]): |
|
|
print(p(data).to_list(kv_format=True)) |
|
|
print(p(data).to_list(kv_format=True)) |
|
|
|
|
|
|
|
|
# batch |
|
|
# batch |
|
|
for data in DataLoader(ops.data_source.sql('sqlite:///./sqlite.db'), batch_size=10): |
|
|
|
|
|
|
|
|
for data in DataLoader(ops.data_source.sql('sqlite:///./sqlite.db', 'image_table'), parser=lambda x: x[1], batch_size=10): |
|
|
p.batch(data) |
|
|
p.batch(data) |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|