llama-cpp-python-gradio
is a Python package that makes it easy for developers to create machine learning apps powered by llama.cpp models using Gradio.
Installation
You can install llama-cpp-python-gradio directly using pip:
pip install llama-cpp-python-gradio
Basic Usage
First, you'll need a GGUF model file for llama.cpp. Then in a Python file, write:
import gradio as gr
import llama_cpp_python_gradio
gr.load(
model_path='path/to/your/model.gguf',
src=llama_cpp_python_gradio.registry,
).launch()
Run the Python file, and you should see a Gradio Interface connected to your local llama.cpp model!
Customization
You can customize the interface by passing additional arguments to the Llama constructor:
import gradio as gr
import llama_cpp_python_gradio
gr.load(
model_path='path/to/your/model.gguf',
src=llama_cpp_python_gradio.registry,
n_ctx=2048, # context window size
n_gpu_layers=1 # number of layers to offload to GPU
).launch()
Under the Hood
The llama-cpp-python-gradio library has two main dependencies: llama-cpp-python and gradio. It provides a "registry" function that creates a Gradio ChatInterface connected to your local llama.cpp model.
The interface supports both text and image inputs (for multimodal models), with automatic handling of file uploads and base64 encoding.
Note: Make sure you have a compatible GGUF model file before running the interface. You can download models from sources like Hugging Face or convert existing models to GGUF format.
Metadata
Release files for llama-cpp-python-gradio 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| llama_cpp_python_gradio-0.0.1.tar.gz | 110.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_cpp_python_gradio-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 114.7 kB
Release files / llama_cpp_python_gradio-0.0.1.tar.gz
| Download URL | llama_cpp_python_gradio-0.0.1.tar.gz |
|---|---|
| Size | 110.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b879f480ed0495c2be3f584e2b8968712a4b24469e9428813544eec6e23f28e
|
|
BLAKE2b-256 checksum How to use checksums |
c64629136963105f1d990995b2258ef072d1187c261d70a0400b81f86d5b8812
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.6
|
Release files / llama_cpp_python_gradio-0.0.1-py3-none-any.whl
| Download URL | llama_cpp_python_gradio-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2a0979049b8e31b669995000fa28df721da44b93644da5e801fdf2c65b8a27f
|
|
BLAKE2b-256 checksum How to use checksums |
c26ef7e695e76afb1592cf26f198f342bdc566780dafc612527f78854e5a3f0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.6
|
Security for llama-cpp-python-gradio 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.