A Python package providing utilities for interacting with the Draw Things gRPC server. This package includes tools for server installation, management, and client communication.
-
Server Management Tools:
- Installation and configuration of the Draw Things gRPC server
- Server lifecycle management (start, stop, restart)
- Health monitoring and status checks
- Log file management
-
Client Utilities:
- Python helper functions for connecting to the gRPC server
- Error handling utilities for gRPC calls
- Connection management tools
-
Security Features:
- TLS configuration management
- Authentication setup
- Certificate management
- Image Generation Logic: The actual image generation is handled by the Draw Things gRPC server
- Model Management: Model loading and management is handled by the server
- GPU Management: GPU configuration is handled by the server
- Web Interface: This is a command-line and programmatic interface only
- Endpoint Management: The gRPC server's endpoints are fixed and cannot be modified through this tool
- Server Management: One-command installation and configuration of the Draw Things gRPC server
- gRPC Client Utilities: Python library for easy integration with the image generation service
- File Management: Tools for handling server files and configurations
- Health Monitoring: Built-in health check endpoints for server status verification
- Security Features:
- TLS encryption support for secure communication
- Authentication via shared secrets
- Certificate chain verification
- Client certificate validation
# Clone the repository
git clone https://github.com/funkatron/draw-things-grpcservercli-installer.git
cd draw-things-grpcservercli-installer
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On macOS/Linux
# or
.\venv\Scripts\activate # On Windows
# Install the package
pip install .
Note: Always activate the virtual environment before using dts-util commands:
source venv/bin/activate # On macOS/Linux
# or
.\venv\Scripts\activate # On Windows
If you're new to the Draw Things gRPC server, here's a simple guide to get you started:
- Install the Server:
# This will install the server with default settings
dts-util install
- Verify the Server is Running:
dts-util test
- Generate Your First Image:
from dts_util.grpc.utils import create_channel_and_stub, handle_grpc_error
from dts_util.grpc.proto.image_generation_pb2 import GenerateImageRequest
# Connect to the server (defaults to localhost:7859, no TLS)
channel, stub = create_channel_and_stub(port=7859)
# Generate an image
with handle_grpc_error():
response = stub.GenerateImage(GenerateImageRequest(
prompt="a beautiful sunset over mountains", # Describe what you want to generate
negative_prompt="", # What you don't want in the image
width=512, # Image width in pixels
height=512 # Image height in pixels
))
# Change port and model path
dts-util install --port 7860 --model-path /path/to/model
# Enable advanced features
dts-util install --model-browser --debug
# Enable TLS and set a shared secret
dts-util install --shared-secret "your-secret-here"
# Check server status
dts-util test
# Restart the server
dts-util restart
# Uninstall the server
dts-util uninstall
- Check server status:
dts-util test
- Check server logs:
cat ~/.config/draw-things/server.log
- Verify server is running:
dts-util test
- Check port availability:
dts-util test --port 7860
- Check TLS configuration:
# If using TLS, ensure your client is configured correctly
# You can verify server configuration in ~/.config/draw-things/server.conf
The package is organized into several modules:
src/
├── dts_util/
│ ├── installer/ # Server installation and management
│ ├── grpc/ # Client communication tools
│ └── utils/ # Shared utilities
For advanced users, here are all available installation options:
# Basic settings
dts-util install --port 7860 --model-path /path/to/model
# Security settings
dts-util install --shared-secret "your-secret-here"
# Advanced settings
dts-util install --model-browser --debug --no-flash-attention
from dts_util.grpc.utils import create_channel_and_stub, handle_grpc_error
from dts_util.grpc.proto.image_generation_pb2 import GenerateImageRequest
# Connect to server
channel, stub = create_channel_and_stub(port=7859)
# Generate image
with handle_grpc_error():
response = stub.GenerateImage(GenerateImageRequest(
prompt="a beautiful landscape",
negative_prompt="blurry, low quality",
width=512,
height=512
))
from dts_util.grpc.utils import handle_grpc_error
try:
with handle_grpc_error():
# Your code here
pass
except Exception as e:
print(f"Error occurred: {e}")
- API Documentation: Documentation for this package's utilities and functions
- CLI Reference: Complete reference for the
dts-util
command-line tool
- Protocol Buffer Specifications: Documentation of the gRPC server's API and message definitions
- For complete server documentation, please refer to the Draw Things documentation
- Python 3.8+
- gRPC tools
- Protocol Buffers compiler
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.