No project description provided
Project description
Langflow Streamlit Integration
Table of Contents
Introduction
langflow-streamlit
is a powerful API that bridges the gap between Langflow and Streamlit applications. This library seamlessly integrates Langflow's advanced language processing capabilities with Streamlit's user-friendly interface, enabling developers to create interactive applications that harness the power of sophisticated language models.
Important: To use this library effectively, you need to set up a Langflow Store Key. This key allows you to access and use flows and components from the Langflow Store. For more information on setting up your Langflow Store Key, please refer to the Langflow documentation.
Features
- Seamless Integration: Effortlessly establish communication between Langflow and Streamlit with minimal configuration.
- Streamlined Deployment: Quickly install and run the API using either
pip
orpoetry
. - Flexible Execution Options: Choose to run the full stack (Langflow + Streamlit API) or just the Streamlit backend with API.
- Langflow Store Integration: Access and utilize pre-built flows and Streamlit components from the Langflow Store to enhance your applications.
Requirements
- Python 3.10 or higher
Installation
Option 1: Install via pip
python3 -m venv env
source env/bin/activate
pip install langflow-streamlit==0.1.8
Option 2: Clone the repository and use Poetry
-
Clone the repository:
git clone https://github.com/yaitec/langflow-streamlit.git cd langflow-streamlit
-
Install Poetry if you haven't already:
pip install poetry
-
Install the project dependencies:
poetry install
How to run
If choose pip installation option
-
Run the full stack (Langflow, API, and Streamlit):
python -m langflow-streamlit run
-
Run only the Streamlit backend and API:
python -m langflow-streamlit run --streamlit-only
If choose clone the repository option
-
Run the full stack (Langflow, API, and Streamlit):
make start
-
Run only the Streamlit backend and API:
make start-streamlit-only
Note: Running only the Streamlit backend is useful when you want to use Langflow-created flows in your Streamlit application without running the full Langflow instance.
How to open each aplication(after running the project)
Open the URLs below in your browser
- Streamlit Chat:: Available at http://localhost:5001.
- Streamlit API: The API Documentation can abe accessed at http://localhost:7881/docs.
- Langflow: Available at http://localhost:7860.
Starter Projects
How to get Streamlit's Flows from the store
The gif below shows how to search, download, and run Streamlit's flow:
Using Streamlit Components in Langflow
The gif below shows how to use Listen
and Send
components:
Streamlit Components
Langflow provides pre-built Streamlit components that can be accessed through the Langflow store. These components enhance your Streamlit applications with powerful functionality:
- Send: Send messages to a Streamlit chat session.
- Listen: Listen for incoming messages in a Streamlit chat, dynamically updating the layout of the Streamlit application.
To use these components:
- Access the Langflow store within your Langflow instance.
- Search for and download the desired Streamlit component.
- Integrate the component into your Langflow workflow.
- Connect the component to your Streamlit application using the
langflow-streamlit
API.
For detailed instructions on using Streamlit components, refer to the Usage section below.
Environment Variables
Variable | Description | Default |
---|---|---|
STREAMLIT_ONLY | If True, runs only Streamlit and Streamlit API; else, runs Langflow too | False |
LOG_LEVEL | Defines log level of library | "info" |
LOG_FILE_GENERATION | If True, creates a langflow-streamlit.log file for debug purpose and overrides LOG_LEVEL to 'debug' | False |
Setting Environment Variables
You can learn how to set environment variables for each alternative bellow, click in the arrow that correlated to installation option that you choosed and check how to setup it properly.
If you choose pip installation option
these are the options that you can set:langflow-streamlit --streamlit-only --log-level error --log-file-generation
If you choose clone the repository option
-
Setting it in zsh or bash
export STREAMLIT_ONLY=True LOG_LEVEL=debug LOG_FILE_GENERATION=True
-
Setting it in PowerShell
$env:STREAMLIT_ONLY = "True" $env:LOG_LEVEL = "debug" $env:LOG_FILE_GENERATION = "True"
Using Poetry (after cloning the repository)
-
Run the full stack:
poetry run langflow-streamlit run
-
Run only the Streamlit frontend and API backend:
poetry run langflow-streamlit run --streamlit-only
Using Make Commands
-
Run the full stack:
make start
-
Run only the Streamlit frontend and API backend:
make start-streamlit-only
-
Check the other available commands:
make help
Development
To set up the development environment:
-
Clone the repository (if you haven't already).
-
Enter inside the cloned repository directory.
cd <repository_path>
-
Install development dependencies:
poetry install --with dev
-
Run tests:
make test
-
Check code style:
make lint
Contributing
We welcome contributions! Please feel free to submit a Pull Request or open an Issue on the GitHub repository.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
YAITEC - contact@yaitec.org
Project Link: https://github.com/yaitec/langflow-streamlit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file langflow_streamlit-0.1.8.tar.gz
.
File metadata
- Download URL: langflow_streamlit-0.1.8.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d288302007e2737bc902403bf497f86774afc9efc90c21e3f30c2ecba782e43 |
|
MD5 | b955a00a6745f8e334f30304f581bf82 |
|
BLAKE2b-256 | 45736d978306577c05679aeb8cf37934280b4d36efa765826bcd8c291819be42 |
File details
Details for the file langflow_streamlit-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: langflow_streamlit-0.1.8-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0216f36ef605340fcd5accbe1acc72ee6c25edcdc16e62d65dbe1bbbd34c87ef |
|
MD5 | bdebdd5d3b9b4f87b4cef144db556a9d |
|
BLAKE2b-256 | b3efc879a2699848ced3483ed0e0aa1e2ee83b6b4a4d12ed80d6855696f7b93b |