charann29 / cmr_opensource

96 stars 193 forks source link

S5 b12 llama2 medical chatbot nishanth #561

Open nishanth1827 opened 4 days ago

nishanth1827 commented 4 days ago

Llama2 Medical Chatbot

Overview

Llama2 Medical Chatbot is an intelligent assistant designed to provide information and assistance related to medical queries.

Libraries Used -

How the Program is Running

  1. Imports necessary libraries for document processing, creating embeddings, setting up the chatbot, and the web interface using Streamlit.
  2. Uses DirectoryLoader to load all PDF files from the data/ directory.
  3. Splits the content of the PDF files into smaller chunks using RecursiveCharacterTextSplitter.
  4. Uses a Hugging Face model to generate embeddings for the text chunks.
  5. Stores the text chunks and their embeddings in a FAISS vector store for efficient retrieval.
  6. Loads a pre-trained language model using CTransformers.
  7. Creates a ConversationalRetrievalChain that uses the language model and vector store to handle queries, along with conversation memory to track chat history.
  8. Sets up the Streamlit app interface, including the title and layout for displaying chat history and user input.
  9. Initializes session state variables to store chat history and generated responses.
  10. Displays the chat interface, handling user input and displaying the chat history using Streamlit.

Use of the CHATBOT

To run the Program

pip install -r requirements.txt

Change the Environment to a env in which you have installed all of this

streamlit run app.py

Make sure to install llama-2-7b-chat.ggmlv3.q4_0.bin

from https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/tree/main for easy running of the app.

FOR STEP BY STEP PROCESS CHECK THIS VIDEO

Process

OUTPUT -

alt text