<jupyter_start><jupyter_text>CLI<jupyter_code>#export
import typer
import memery.core
import streamlit.cli
#export
app = typer.Typer()<jupyter_output><empty_output><jupyter_text>Sometimes you just want to be able to pipe information through the terminal. This is that command<jupyter_code>#export
@app.command()
def recall(path: str, query: str, n: int = 10):
    """Search recursively over a folder from the command line"""
    ranked = memery.core.query_flow(path, query=query)
    print(ranked[:n])
#     return(ranked)
recall('./images', 'a funny dog meme')<jupyter_output>Searching 80 images
Done in 0.004800149999937275 seconds
['images/Wholesome-Meme-8.jpg', 'images/Wholesome-Meme-35.jpg', 'images/Wholesome-Meme-5.jpg', 'images/Wholesome-Meme-67.png', 'images/Wholesome-Meme-44.png', 'images/Wholesome-Meme-71.jpg', 'images/Wholesome-Meme-15.jpg', 'images/Wholesome-Meme-18.jpg', 'images/Wholesome-Meme-72.jpg', 'images/Wholesome-Meme-39.jpg']<jupyter_text>More often, though, you probably want to sift through image visually. The `memery serve` command will open a browser app on your local device, using Streamlit library.<jupyter_code>#export
@app.command()
def serve():
    """Runs the streamlit GUI in your browser"""
    path = memery.__file__.replace('__init__.py','streamlit_app.py')
    streamlit.cli.main(['run',path])
# serve()
#export 
def __main__():
    app()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.141643059490085, 'fraction_numerical': 0.02903682719546742, 'mean_word_length': 5.665094339622642, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '80237', 'license': 'MIT', 'n_tokens_mistral': 526, 'n_tokens_neox': 498, 'n_words': 114, 'path': '07_cli.ipynb', 'repo_name': 'deepfates/memery', 'size': '1412'}