Download augmentoolkit/utils/create_conv_starter.py from Leon4gr45/agent-0: direct link, hf CLI and curl.
- Browser
- Download file 808 Bytes
-
https://huggingface.co/spaces/Leon4gr45/agent-0/resolve/main/augmentoolkit/utils/create_conv_starter.py
- Command line
-
hf download hf://spaces/Leon4gr45/agent-0/augmentoolkit/utils/create_conv_starter.py
-
curl -L -o create_conv_starter.py https://huggingface.co/spaces/Leon4gr45/agent-0/resolve/main/augmentoolkit/utils/create_conv_starter.py
808 Bytes
| from augmentoolkit.utils.extract_first_words import extract_first_words | |
| from augmentoolkit.generation_functions import extract_name | |
| import random | |
| def create_conv_starter(character): | |
| charname = extract_name.extract_name(character) | |
| first_words_of_card = extract_first_words(charname, character) | |
| conv_starters = [ # prevents it from regurgitating the card (when combined with filtering) | |
| "Ah", | |
| "Oh", | |
| # "You", | |
| # "Really", | |
| "I", | |
| # "What", | |
| # "So", | |
| "Welcome", | |
| "Hey", | |
| # "Look", | |
| # "Now", | |
| # "Huh", | |
| "It's", | |
| "Hello", | |
| ] | |
| conv_starters_filtered = [ | |
| starter for starter in conv_starters if starter not in first_words_of_card | |
| ] | |
| return random.choice(conv_starters_filtered) | |