Code Monkey home page Code Monkey logo

civitai-cli's Introduction

Banner

Introduction

CivitAI-CLI: Streamlined Access to CivitAI Models

The CivitAI-CLI is a command-line interface tool crafted to enhance user interactions with the CivitAI API. Its primary goal is to simplify the processes of listing, displaying, fetching, and downloading models available on CivitAI.

Key Features of CivitAI-CLI:

  • Efficient Interactions: CivitAI-CLI provides a user-friendly approach, eliminating the complexities of manual API endpoint handling. Easily fetch, list, and download models straight from your terminal.

  • Optimized Visual Experience with viu: The tool leverages viu for image rendering, offering improved visual feedback in terminals such as iTerm2 and Kitty. For those on alternative terminals, an ANSI display is available to ensure consistent user experience.

  • Enhanced Functionality with an API Key: While CivitAI-CLI is versatile without an API key, possessing one grants access to an extended array of features.

The Genesis of CivitAI-CLI:

Developed out of a specific need to download models on remote servers via SSH, especially for servers running stable diffusion systems, the CivitAI-CLI addresses this niche requirement, ensuring efficient access to CivitAI's models regardless of the user's location.

CivitAI may house a myriad of models, ranging from the academically serious to the more leisurely. However, the CivitAI-CLI aims to be a tool of choice for anyone seeking a streamlined interface to this platform.

Table of Contents

Installation

To utilize CivitAI-CLI and ensure a clean environment without dependency conflicts, it's recommended to install it within a Python virtual environment (venv). Here are the steps to clone the repository, set up a venv, and install the necessary dependencies:

Prerequisites

Ensure you have Python 3.6 or later and pip installed on your system. If not, download and install Python from the official website and pip will be included.

Clone the Repository

To quickly set up, you can use the following one-liner:

git clone https://github.com/roadmaus/CivitAI-CLI.git && cd CivitAI-CLI && [[ -x start.sh ]] || chmod +x start.sh && ./start.sh

Or you can manually clone it:

git clone https://github.com/roadmaus/CivitAI-CLI.git
cd CivitAI-CLI

Setup Virtual Environment (venv)

To create and activate a virtual environment:

For Windows

python -m venv myenv
.\myenv\Scripts\activate

For MacOS/Linux

python3 -m venv myenv
source myenv/bin/activate

Note: Ensure your shell is in the directory where myenv is created. Also windows support is not tested yet and will likely break.

Install Dependencies

With the virtual environment activated, install the dependencies:

pip install -r requirements.txt

To deactivate the virtual environment when you're done:

deactivate

After setting up and activating your venv, you can use CivitAI-CLI while keeping your Python environment clean and managed.

Installing VIU

For the most up-to-date installation instructions for viu, please refer to the official repository.

Environment Variables (Optional but very much recommended)

To access additional features and to download models that require a login, set the CIVITAI_API_KEY environment variable with your API key:

export CIVITAI_API_KEY=your_api_key_here

Usage

Explore the various functionalities provided by CivitAI-CLI:

Main Menu

 > List models
   Fetch model by ID
   Download model by ID
   Scan for missing data
   No interrupted downloads
   Fetch model version by ID
   Fetch model by Hash
   Settings
   Exit

Settings Menu

 > Change display mode
   Adjust image size
   Set default query
   Set model version preference
   Set root directory
   Back to main menu

Browsing Options

 > Next page
   Previous page
   Jump to page
   Filter this search
   Search Model
   Select to Download
   Initiate Download
   Initiate Background Download
   Select for more Info
   Back to main menu

Model Display Example

Displayed using text mode:

πŸ†” ID: 157458
🌐 URL: https://civitai.com/models/157458
πŸ“› Name: The Devil (The Cuphead Show) Cartoon Character LoRA
πŸ‘€ Creator: PlagSoft
πŸ€– Type: LoCon
πŸ› οΈ Base Models: SD 1.5
⭐ Rating: 0
πŸ”ž NSFW: False
🏷️ Tags: character, cartoon, demon, cuphead, character,, devil, 1930s
πŸ“¦ File Size: 29.67 MB

-- Scans --
🐍 Pickle Scan: Success
πŸ”¬ Virus Scan: Success
πŸ—“οΈ Scanned At: 2023-10-06T03:45:42.181Z

-- Description --
πŸ“ Description: "β™ͺ In case you ain't heard, I'm the Devil! I'm a real low-down, not on the level!" These are the results of my first experiments with a Google Colab LoRA maker. Early versions were made with PixAI and l...

Visual Showcase

Here's how CivitAI-CLI displays models in the iTerm2 terminal using viu: Model Display in iTerm2 with viu

And here's a display in a standard terminal using the ANSI display: Model Display in Standard Terminal with ANSI

Current State and Functionalities

CivitAI-CLI presently allows users to:

  • List and filter models
  • Download models
  • Fetch model info
  • Set a default query and download path (aligns with Automatic1111's webui directory structure)
  • Scan for missing metadata (currently it replaces old metadata if not in the same format)
  • Switch display mode between Text only or Image
  • Adjust image sizes
  • Set a content filter for images (options: block, blur, or show)
  • Resume interrupted downloads (partially implemented)
  • check for updated versions
  • install and run it using the one-liner (or install script)

To-Do

Future updates aim to provide:

  • Enhanced model cards for details
  • Fetching models by hash
  • Improved metadata management

civitai-cli's People

Contributors

dependabot[bot] avatar roadmaus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

civitai-cli's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.