Spaces:
Build error
Build error
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,178 +1,6 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
This is a Django-based web application that allows users to upload files and chat with an AI-powered chatbot. The chatbot analyzes the uploaded file and responds to user queries based on the content of the file. Users can upload various file formats such as `.txt`, `.pdf`, `.csv`, `.xls`, `.xlsx`, `.md`, and `.docx`.
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
## Table of Contents
|
| 11 |
-
|
| 12 |
-
- [Introduction](#introduction)
|
| 13 |
-
- [Architecture Diagram](#architecture-diagram)
|
| 14 |
-
- [Features](#features)
|
| 15 |
-
- [Technology Stack](#technology-stack)
|
| 16 |
-
- [Installation](#installation)
|
| 17 |
-
- [Configuration](#configuration)
|
| 18 |
-
- [Usage](#usage)
|
| 19 |
-
- [File Structure](#file-structure)
|
| 20 |
-
- [Troubleshooting](#troubleshooting)
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
## Introduction
|
| 24 |
-
|
| 25 |
-
This project provides an AI-powered chatbot that interacts with users based on the content of uploaded files. Users can upload files in various formats (such as PDF, DOCX, CSV, etc.), and the chatbot will process and analyze the content to answer questions related to the file.
|
| 26 |
-
|
| 27 |
-
## Architecture Diagram
|
| 28 |
-
|
| 29 |
-
Below is an overview of the architecture of the Azones Chat with File:
|
| 30 |
-
|
| 31 |
-

|
| 32 |
-
|
| 33 |
-
### Explanation:
|
| 34 |
-
The flowchart depicts a system designed to handle both text input and file uploads. The primary goal is to process, store, and retrieve semantically meaningful information to answer user queries efficiently.
|
| 35 |
-
|
| 36 |
-
1. **Upload File**: Users can upload various file formats such as `.txt`, `.pdf`, `.csv`, `.xls`, `.xlsx`, `.md`, and `.docx`.
|
| 37 |
-
|
| 38 |
-
2. **Extract Content**: Extract text content from the file for processing
|
| 39 |
-
|
| 40 |
-
3. **Split into Chunks**: The text is split into smaller chunks for efficient processing.
|
| 41 |
-
|
| 42 |
-
4. **Mistral Embeddings**: These chunks are processed using the Mistral language model to generate embeddings (numerical representations of text).
|
| 43 |
-
|
| 44 |
-
5. **Faiss Vector DB**: The embeddings are stored in the Faiss vector database for high-speed similarity search.
|
| 45 |
-
|
| 46 |
-
6. **User Input**: The user asks the question related to the uploaded file.
|
| 47 |
-
|
| 48 |
-
7. **Semantic Search**: The user’s query is converted into embeddings, which are compared to stored embeddings to find the closest matches.
|
| 49 |
-
|
| 50 |
-
8. **Mistral LLM**: The most relevant text chunks are fed to the Mistral language model, generating answers to the user's query.
|
| 51 |
-
|
| 52 |
-
## Features
|
| 53 |
-
|
| 54 |
-
- Upload files in various formats (TXT, PDF, CSV, XLS, XLSX, MD, DOCX).
|
| 55 |
-
|
| 56 |
-
- Drag-and-drop file upload or browse functionality.
|
| 57 |
-
|
| 58 |
-
- Chatbot interaction based on file content.
|
| 59 |
-
|
| 60 |
-
- Real-time question answering and response from the AI chatbot.
|
| 61 |
-
|
| 62 |
-
- Option to download the chat history.
|
| 63 |
-
|
| 64 |
-
- Simple, user-friendly interface using Bootstrap for styling.
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
## Technology Stack
|
| 68 |
-
|
| 69 |
-
- **Backend**: Django (Python)
|
| 70 |
-
- **Frontend**: Bootstrap (HTML, CSS, JavaScript)
|
| 71 |
-
- **Vector Store**: FAISS
|
| 72 |
-
- **LLM Model**: Mistral
|
| 73 |
-
|
| 74 |
-
## Installation
|
| 75 |
-
|
| 76 |
-
### Prerequisites
|
| 77 |
-
|
| 78 |
-
- Python 3.11
|
| 79 |
-
- Django 5.0.7
|
| 80 |
-
- Mistral AI Subscription
|
| 81 |
-
|
| 82 |
-
### Step-by-Step Guide
|
| 83 |
-
|
| 84 |
-
1. **Clone the Repository**:
|
| 85 |
-
```bash
|
| 86 |
-
git clone https://github.com/AZONES-TECHNOLOGIES/Chat_with_File.git
|
| 87 |
-
cd Chat_with_File
|
| 88 |
-
```
|
| 89 |
-
|
| 90 |
-
2. **Create a Virtual Environment**:
|
| 91 |
-
```bash
|
| 92 |
-
python3 -m venv venv
|
| 93 |
-
venv\Scripts\activate # On Windows use
|
| 94 |
-
```
|
| 95 |
-
|
| 96 |
-
3. **Install the Required Python Packages**:
|
| 97 |
-
```bash
|
| 98 |
-
pip install -r requirements.txt
|
| 99 |
-
```
|
| 100 |
-
|
| 101 |
-
4. **Environment Variables**:
|
| 102 |
-
- Create a `.env` file in the root directory.
|
| 103 |
-
- Add the following environment variables:
|
| 104 |
-
```
|
| 105 |
-
app=your_Mistral_api_key
|
| 106 |
-
```
|
| 107 |
-
|
| 108 |
-
5. **Navigate to the working directory**:
|
| 109 |
-
```bash
|
| 110 |
-
cd chat
|
| 111 |
-
```
|
| 112 |
-
|
| 113 |
-
6. **Start the Development Server**:
|
| 114 |
-
```bash
|
| 115 |
-
python manage.py runserver
|
| 116 |
-
```
|
| 117 |
-
|
| 118 |
-
## Configuration
|
| 119 |
-
|
| 120 |
-
- **Valid Document**: Upload the valid document format such as `.txt`, `.pdf`, `.csv`, `.xls`, `.xlsx`, `.md`, and `.docx`.
|
| 121 |
-
- **API Keys**: Ensure your Mistral API key is correctly set in the `.env` file.
|
| 122 |
-
|
| 123 |
-
## Usage
|
| 124 |
-
|
| 125 |
-
1. Navigate to the application in your browser:
|
| 126 |
-
- Open `http://127.0.0.1:8000` in your web browser.
|
| 127 |
-
2. Upload a file:
|
| 128 |
-
- Use the drag-and-drop area or browse button to upload your file.
|
| 129 |
-
3. Interact with the chatbot:
|
| 130 |
-
- After uploading, you will be redirected to the chatbot interface. Type your questions related to the file content and get responses.
|
| 131 |
-
4. Download chat history:
|
| 132 |
-
- Click the "Download Chat" button to save the conversation history.
|
| 133 |
-
|
| 134 |
-
## File Structure
|
| 135 |
-
|
| 136 |
-
```plaintext
|
| 137 |
-
Chat_with_File/
|
| 138 |
-
├── .env # Environment variables
|
| 139 |
-
├── venv # Virtual Environment
|
| 140 |
-
├── requirements.txt # Python dependencies
|
| 141 |
-
├── README.md # Project README
|
| 142 |
-
├── chat/
|
| 143 |
-
│
|
| 144 |
-
├── app/ # Main Django app
|
| 145 |
-
│ ├── __pycache__/
|
| 146 |
-
│ ├── migrations/
|
| 147 |
-
│ ├── __init__.py
|
| 148 |
-
│ ├── admin.py
|
| 149 |
-
│ ├── apps.py
|
| 150 |
-
│ ├── models.py
|
| 151 |
-
│ ├── tests.py
|
| 152 |
-
│ ├── urls.py
|
| 153 |
-
│ ├── views.py # Django views handling logic
|
| 154 |
-
|
|
| 155 |
-
│
|
| 156 |
-
├── static/ # Static files (CSS, JS, images)
|
| 157 |
-
│ ├── images/
|
| 158 |
-
│
|
| 159 |
-
├── templates/ # HTML template for the chatbot interface
|
| 160 |
-
│ ├── base.html
|
| 161 |
-
│ ├── chat.html
|
| 162 |
-
│ ├── doc.html
|
| 163 |
-
│
|
| 164 |
-
├── chat/
|
| 165 |
-
│ ├── __pycache__/
|
| 166 |
-
│ ├── __init__.py
|
| 167 |
-
│ ├── asgi.py
|
| 168 |
-
│ ├── settings.py
|
| 169 |
-
│ ├── urls.py
|
| 170 |
-
│ ├── wsgi.py
|
| 171 |
-
|
|
| 172 |
-
├── manage.py # Django project management script
|
| 173 |
-
└── ...
|
| 174 |
-
```
|
| 175 |
-
## Troubleshooting
|
| 176 |
-
**API Key Issues**: Ensure the API key and region are correctly set in the `.env` file.
|
| 177 |
-
|
| 178 |
-
**Valid Document**: Upload the valid document format such as `.txt`, `.pdf`, `.csv`, `.xls`, `.xlsx`, `.md`, and `.docx`.
|
|
|
|
| 1 |
+
title: Chat With File Pinecone
|
| 2 |
+
emoji: 🏃
|
| 3 |
+
colorFrom: yellow
|
| 4 |
+
colorTo: red
|
| 5 |
+
sdk: docker
|
| 6 |
+
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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