Update README.md
Browse files
README.md
CHANGED
|
@@ -19,4 +19,59 @@ See [deepghs/search_image_by_image_or_text](https://huggingface.co/spaces/deepgh
|
|
| 19 |
|
| 20 |
### Compatibility
|
| 21 |
|
| 22 |
-
The checkpoints in this repo have been structured for compatibility with the [dghs-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
### Compatibility
|
| 21 |
|
| 22 |
+
The checkpoints in this repo have been structured for compatibility with the [dghs-imgutils](https://github.com/deepghs/imgutils) package.
|
| 23 |
+
|
| 24 |
+
You can run it locally with the following 2 approaches
|
| 25 |
+
|
| 26 |
+
#### Infer with Code
|
| 27 |
+
|
| 28 |
+
```shell
|
| 29 |
+
pip install dghs-imgutils>=0.17.0
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from imgutils.generic import siglip_predict
|
| 34 |
+
|
| 35 |
+
pred = siglip_predict(
|
| 36 |
+
images=[
|
| 37 |
+
'https://huggingface.co/datasets/narugo1992/nzb_files/resolve/main/eshuushuu_51.webp',
|
| 38 |
+
],
|
| 39 |
+
texts=[
|
| 40 |
+
# short tags
|
| 41 |
+
'1girl',
|
| 42 |
+
'1boy',
|
| 43 |
+
'orange_hair',
|
| 44 |
+
'blue_hair',
|
| 45 |
+
|
| 46 |
+
# long text
|
| 47 |
+
'1girl, solo, thighhighs, orange_shirt, twintails, brown_hair, hair_bun, long_hair, double_bun, '
|
| 48 |
+
'zettai_ryouiki, jar, sitting, bow, school_uniform, long_sleeves, smile, pink_bow, skirt, orange_skirt, '
|
| 49 |
+
'very_long_hair, black_thighhighs, orange_dress, miniskirt',
|
| 50 |
+
'food, halo, red_eyes, side_ponytail, skirt, macaron, pink_hair, sailor_collar, holding, '
|
| 51 |
+
'black_sailor_collar, cake, long_hair, drumsticks, black_skirt, pleated_skirt, pink_halo, 1girl, '
|
| 52 |
+
'ahoge, red_neckerchief, chibi, neckerchief, long_sleeves, holding_food, sash, blush, holding_drumsticks, '
|
| 53 |
+
'multiple_views, white_cardigan, looking_at_viewer,'
|
| 54 |
+
],
|
| 55 |
+
repo_id='deepghs/siglip_beta',
|
| 56 |
+
model_name='smilingwolf/siglip_swinv2_base_2025_02_22_18h56m54s'
|
| 57 |
+
)
|
| 58 |
+
print(pred)
|
| 59 |
+
# [[2.5059912e-02 1.7571157e-04 2.1646977e-03 1.8494057e-04 1.0000000e+00
|
| 60 |
+
# 3.8877626e-15]]
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
#### Launch a Gradio Demo
|
| 64 |
+
|
| 65 |
+
```shell
|
| 66 |
+
pip install dghs-imgutils[demo]>=0.17.0
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
from imgutils.generic import SigLIPModel
|
| 71 |
+
|
| 72 |
+
SigLIPModel(
|
| 73 |
+
repo_id='deepghs/siglip_beta',
|
| 74 |
+
).launch_demo(
|
| 75 |
+
default_model_name='smilingwolf/siglip_swinv2_base_2025_02_22_18h56m54s'
|
| 76 |
+
)
|
| 77 |
+
```
|