An AI Assistance that helps you get information from an uploaded PDF file.
Chat with your PDF file and get responses. Build using Python (Flask), Vanilla Javascript and Gemini AI API.
- Upload Files: Upload PDF, TXT, DOCX, or PPTX files to extract their content.
- Chat with Files: Ask questions about the uploaded files and get AI-generated responses.
- Recent Files: View and select recently uploaded files.
- Recent Chats: Access previous conversations for reference.
- Dynamic Content: All file and chat data are dynamically loaded and updated.
- Backend: Python (Flask)
- Frontend: HTML, CSS, Vanilla JavaScript
- Database: SQLite for storing extracted file content and chat conversations.
- AI Integration: Gemini AI API for generating responses to user queries.
-
Clone the repository:
git clone https://github.com/realitystevens/DocGenius.git cd DocGenius
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.env
file in the root directory. - Add the following variables:
ENV = development GOOGLE_API_KEY = "<gemini-api-key>"
- Add a Gemini AI Key. Get an API key from here
- Create a
-
Run the application:
python app.py
-
Open your browser and navigate to
http://127.0.0.1:5000
.
-
Upload a File:
- Use the "Add a new PDF" section to upload a file.
- Supported formats: PDF, TXT, DOCX, PPTX.
-
Extract Text:
- The uploaded file's content will be extracted and stored in the database.
-
Chat with the File:
- Select a file from the "Recent Files" section.
- Enter a question in the chatbox and click the send button.
- View the AI-generated response in the chat conversation area.
-
View Recent Chats:
- Access previous conversations in the "Recent Chats" section.
DocGenius/
├── static/
│ ├── AIChatHandler.js # Handles AI chat interactions
│ ├── fileHandler.js # Manages file-related operations
│ ├── saveFile.js # Handles file upload and saving
│ └── style.css # Styling for the application
├── templates/
│ └── index.html # Main HTML template
├── utils/
│ ├── app_utils.py # Utility functions for logging and AI responses
│ ├── extractText.py # Functions for extracting text from files
├── app.py # Flask application entry point
├── requirements.txt # Python dependencies
└── README.md # Project documentation
Contributions are welcome! Feel free to fork the repository and submit a pull request.
Built by Reality Stevens.
View the codebase on GitHub.