semvec/pypi-packages huggingface dataset:
getsimilar 0.0.5
Image search: image/text => images.
License: MIT

# Get similar images

![](https://habrastorage.org/webt/5v/aj/x3/5vajx3dlf6fh8nnikka17wz_foc.jpeg)

This tool is a wrapper over an API that returns URLs and similarity scores for similar images for a given image.

You can find a demo of the tool [here](https://ternaus.com/).

The description of the API can be found [here](https://ternaus.com/api).

## Installation

```bash
pip install -U getsimilar
```

## Get an API token

* Log in at: [https://ternaus.com/login](https://ternaus.com/login)
* Go to the account page: [https://ternaus.com/account](https://ternaus.com/account)
* Generate new token and save json file with it to `~/.ternaus/ternaus.json`

## Usage

You pass:

* Image in the form of the `numpy` array or `PIL` image.
* URL to the image:
* Text query, for example: "Girls in weird hats"

#### Optional parameters:

* `num_similar` that specifies the number of similar images to return. This number is capped at 50. If you would like to
  get more similar images per request, please contact us
  at [https://www.ternaus.com/#contact](https://www.ternaus.com/#contact). default value is 1.
* `get_labels` that specifies whether to return labels for the image. default value is None. Right now
  only `coco_yolov7` is supported.`

### From image

```python
from getsimilar.get import from_image

urls = from_image( < numpy or PIL
image >, num_similar = < the
number
of
similar
images >)
```

### From URL

```python
from getsimilar.get import from_url

urls = from_url(url, num_similar= < the
number
of
similar
images >)
```

### From text

```python
from getsimilar.get import from_text

urls = from_text(text, num_similar= < the
number
of
similar
images >)
```
a-pandas-ex-split-on-common-string 0.10
Split a Pandas.Series on a common string
License: MIT
Keywords: pandas,series,split


```python
$pip install a-pandas-ex-split-on-common-string
from a_pandas_ex_split_on_common_string import pd_add_split_on_common_string
pd_add_split_on_common_string()
df = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")
df['text'] = 'myway_/bo' + df.Embarked.astype('string') + '.txt'
print(df.text.s_split_on_common_string(is_path=False))
print(df.text.s_split_on_common_string(is_path=True))

		aa_original  aa_common aa_different
0    myway_/boS.txt  myway_/bo        S.txt
1    myway_/boC.txt  myway_/bo        C.txt
2    myway_/boS.txt  myway_/bo        S.txt
3    myway_/boS.txt  myway_/bo        S.txt
4    myway_/boS.txt  myway_/bo        S.txt
..              ...        ...          ...
886  myway_/boS.txt  myway_/bo        S.txt
887  myway_/boS.txt  myway_/bo        S.txt
888  myway_/boS.txt  myway_/bo        S.txt
889  myway_/boC.txt  myway_/bo        C.txt
890  myway_/boQ.txt  myway_/bo        Q.txt
[891 rows x 3 columns]
		aa_original aa_common aa_different
0    myway_/boS.txt    myway_     /boS.txt
1    myway_/boC.txt    myway_     /boC.txt
2    myway_/boS.txt    myway_     /boS.txt
3    myway_/boS.txt    myway_     /boS.txt
4    myway_/boS.txt    myway_     /boS.txt
..              ...       ...          ...
886  myway_/boS.txt    myway_     /boS.txt
887  myway_/boS.txt    myway_     /boS.txt
888  myway_/boS.txt    myway_     /boS.txt
889  myway_/boC.txt    myway_     /boC.txt
890  myway_/boQ.txt    myway_     /boQ.txt
[891 rows x 3 columns]
```