Skip to content

Latest commit

 

History

History
134 lines (87 loc) · 4.07 KB

README.md

File metadata and controls

134 lines (87 loc) · 4.07 KB

LearnSmart 😎

This Streamlit application allows you to upload PDF files, process their text, and interact with the content using natural language queries powered by Google Gemini AI.

Features

  • Upload PDF Files: Upload multiple PDF files and process them to extract text.
  • Text Chunking: Automatically splits the extracted text into manageable chunks for better processing.
  • Vector Store Creation: Uses Google Generative AI embeddings to create a vector store for efficient similarity searches.
  • Conversational Chain: Utilizes Google Gemini AI to answer questions based on the content of the uploaded PDFs.
  • Interactive UI: Simple and user-friendly interface to interact with your PDFs.

Installation

Prerequisites

  • Python 3.7+

Setup

  1. Clone the repository:

    git clone https://github.com/thevishvammoliya/Learn-Smart
    cd Learn-Smart
  2. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the required packages:

    pip install -r requirements.txt
  4. Set up environment variables:

    Create a .env file in the root of your project and add your Google API key:

    GOOGLE_API_KEY=your-google-api-key

Usage

  1. Run the Streamlit app:

    streamlit run app.py
  2. Upload PDFs:

    • Use the sidebar to upload multiple PDF files.
    • Click on the "Submit & Process" button to extract and process the text from the PDFs.
  3. Ask Questions:

    • Enter your question in the text input field and press Enter.
    • The application will use the content of the uploaded PDFs to answer your question.

How It Works

  1. PDF Text Extraction:

    The get_pdf_text function extracts text from the uploaded PDF files.

  2. Text Chunking:

    The get_text_chunks function splits the extracted text into smaller chunks using RecursiveCharacterTextSplitter.

  3. Vector Store Creation:

    The get_vector_store function creates a vector store from the text chunks using Google Generative AI embeddings and FAISS.

  4. Conversational Chain:

    The get_conversational_chain function sets up a QA chain using Google Gemini AI to answer questions based on the processed PDF content.

  5. User Input Handling:

    The user_input function processes the user's question, performs a similarity search on the vector store, and retrieves the most relevant chunks to generate an answer.

Example

  1. Upload PDFs: Use the sidebar to upload your PDF files.
  2. Ask a Question: Enter a question like "What is the main topic of the document?" in the input field.
  3. Get an Answer: The app will display a detailed answer based on the content of the uploaded PDFs.

Enjoy chatting with your PDFs using LearnSmart! 🚀

Requirements

Here is the content for your requirements.txt file:

streamlit
google-generativeai
python-dotenv
langchain
PyPDF2
chromadb
faiss-cpu
langchain_google_genai
langchain_community

Environment Variables

Replace the API key in env.example file and rename it to .env:

GOOGLE_API_KEY="YOUR_API_KEY_HERE"

Technologies Used

Python Streamlit Google Generative AI Langchain PyPDF2 ChromaDB FAISS dotenv