From d52293e3982c36e5199302baaa9ea310e7836b2b Mon Sep 17 00:00:00 2001 From: Kris <48050596+krisograbek@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:12:36 +0200 Subject: [PATCH 1/5] Create README.md --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..5316d14 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +## Template for creating your own ChatGPT with Streamlit and OpenAI API + +This repository contains the code for a simple web application built with Streamlit, which uses OpenAI's GPT-3 model for generating AI responses in a chat-like interface. + +### Prerequisites +1. Python 3.6 or above +2. An OpenAI API Key + + +### Steps to run the application +1 Clone the repository to your local machine: +```shell +git clone https://github.com/krisograbek/streamlit_chatbot_base.git +``` + +2. Navigate to the project directory: +```shell +cd streamlit_chatbot_base +``` + +3. Create a virtual environment and activate it: + +On macOS and Linux: +shell +Copy code +python3 -m venv myenv +source myenv/bin/activate +On Windows: +shell +Copy code +python -m venv myenv +.\myenv\Scripts\activate +Install the necessary Python packages: +shell +Copy code +pip install -r requirements.txt +Create a .env file in the root directory of the project and add your OpenAI API key: +shell +Copy code +echo OPENAI_API_KEY=your-api-key > .env +Please replace your-api-key with your actual OpenAI API key. + +Run the Streamlit application: +shell +Copy code +streamlit run your-app-script.py +Please replace your-app-script.py with the name of your Streamlit app script. + +Open a web browser and navigate to http://localhost:8501 to interact with the application. +License +This project is open source, under the terms of the MIT license. + +Note: This app makes requests to OpenAI's servers whenever the chat is used. Please be aware of this, especially if you're on a paid plan with OpenAI. From 2fb5ba080733e7b245056aab59c7122b67a3febe Mon Sep 17 00:00:00 2001 From: Kris <48050596+krisograbek@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:14:28 +0200 Subject: [PATCH 2/5] Update README.md --- README.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 5316d14..3863fec 100644 --- a/README.md +++ b/README.md @@ -21,32 +21,36 @@ cd streamlit_chatbot_base 3. Create a virtual environment and activate it: On macOS and Linux: -shell -Copy code +```shell python3 -m venv myenv source myenv/bin/activate +``` + On Windows: -shell -Copy code +```shell python -m venv myenv .\myenv\Scripts\activate -Install the necessary Python packages: -shell -Copy code +``` + +4. Install the necessary Python packages: +```shell pip install -r requirements.txt -Create a .env file in the root directory of the project and add your OpenAI API key: -shell -Copy code +``` + +5. Create a .env file in the root directory of the project and add your OpenAI API key: +```shell echo OPENAI_API_KEY=your-api-key > .env +``` + Please replace your-api-key with your actual OpenAI API key. -Run the Streamlit application: -shell -Copy code -streamlit run your-app-script.py -Please replace your-app-script.py with the name of your Streamlit app script. +6. Run the Streamlit application: +```shell +streamlit run chatbot.py +``` Open a web browser and navigate to http://localhost:8501 to interact with the application. + License This project is open source, under the terms of the MIT license. From 5c0af33d0437321edd076626be1d0b83646b7c23 Mon Sep 17 00:00:00 2001 From: Kris <48050596+krisograbek@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:15:55 +0200 Subject: [PATCH 3/5] Create LICENSE.txt --- LICENSE.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..ce91071 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Krzysztof Ograbek + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 9c8faa7e15e761930bc72ae3032ccd5afa71b96f Mon Sep 17 00:00:00 2001 From: Kris <48050596+krisograbek@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:19:21 +0200 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3863fec..cd35906 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Template for creating your own ChatGPT with Streamlit and OpenAI API -This repository contains the code for a simple web application built with Streamlit, which uses OpenAI's GPT-3 model for generating AI responses in a chat-like interface. +This repository contains the code for a simple web application built with [Streamlit](https://streamlit.io/), which uses OpenAI's GPT-3 model for generating AI responses in a chat-like interface. ### Prerequisites 1. Python 3.6 or above From 02812238232bf8bef579ff0517e07c63e14234a1 Mon Sep 17 00:00:00 2001 From: Kris <48050596+krisograbek@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:28:35 +0200 Subject: [PATCH 5/5] Create requirements.txt --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e1a8170 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +openai +streamlit +python-dotenv