├── README.md ├── requirements.txt ├── LICENSE └── app.py /README.md: -------------------------------------------------------------------------------- 1 | # ChatCSV-Llama2-Chatbot 2 | ChatCSV bot using Llama 2, Sentence Transformers, CTransformers, Langchain, and Streamlit. 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | streamlit 2 | pypdf 3 | langchain 4 | torch 5 | accelerate 6 | bitsandbytes 7 | transformers 8 | sentence_transformers 9 | faiss_cpu -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 AI Anytime 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | from streamlit_chat import message 3 | import tempfile 4 | from langchain.document_loaders.csv_loader import CSVLoader 5 | from langchain.embeddings import HuggingFaceEmbeddings 6 | from langchain.vectorstores import FAISS 7 | from langchain.llms import CTransformers 8 | from langchain.chains import ConversationalRetrievalChain 9 | 10 | DB_FAISS_PATH = 'vectorstore/db_faiss' 11 | 12 | #Loading the model 13 | def load_llm(): 14 | # Load the locally downloaded model here 15 | llm = CTransformers( 16 | model = "llama-2-7b-chat.ggmlv3.q8_0.bin", 17 | model_type="llama", 18 | max_new_tokens = 512, 19 | temperature = 0.5 20 | ) 21 | return llm 22 | 23 | st.title("Chat with CSV using Llama2 🦙🦜") 24 | st.markdown("