nimamahmoudi / LLMStreamlitDemoBasic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LLM Streamlit Demo (Basic)

Installation Process

Without Poetry

You can use conda to install the required packages:

conda create -n p311-llm python=3.11
conda activate p311-llm
pip install -r requirements.txt

With Poetry (optional)

To install the required packages, you can install them using poetry:

# (optional) to set poetry to use the project folder
# poetry config virtualenvs.in-project true
# install all dependencies
poetry install

In case you changed requirements.txt, you'll need to run the following command to update the poetry definitions:

cat requirements.txt | xargs poetry add

You can then enable poetry shell:

poetry shell

Running the App

After installing all requirements, you'll need to add your OpenAI API key to the secrets, or let the user input it in the sidebar every time they visit the page. You can add your secrets to .streamlit/secrets.toml in the following format:

OPENAI_API_KEY = "sk-..."

Then, you can run the code using the following command:

streamlit run app.py

For more detail about this code, you can follow my blog posts.

About

License:MIT License


Languages

Language:Python 100.0%