This is an intelligent chatbot project featuring a Gradio user interface and a backend built with FastAPI, powered by the Google Gemini API. The application allows users to chat, ask questions based on content from URLs, and query PDF documents.
-
Intelligent Chat: Engage in two-way conversations with smooth, streaming responses.
-
Q&A with URLs: Provide a link, and the AI can summarize and answer related questions.
-
Q&A with PDFs: Upload a PDF document and ask questions about its content.
This project is optimized for easy deployment on Hugging Face Spaces, a free platform for hosting ML applications. You can use the link below to view deployment of this project:
https://huggingface.co/spaces/SaitoHoujou/Inori_Chatbot
or view on Youtube:
https://www.youtube.com/watch?v=kPW72mcJ3qU
Follow these steps to set up and run the project on your local machine.
1.Prerequisites
- Python 3.8+
- Git
2. Clone the Repository
git clone <YOUR_REPOSITORY_URL>
cd <PROJECT_DIRECTORY_NAME>
3. Create and Activate a Virtual Environment
Using a virtual environment is crucial for managing dependencies independently.
- Create the virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate- On macOS / Linux:
source venv/bin/activate(After successful activation, you will see
(venv)at the beginning of your command line prompt.)
4. Install Dependencies
This project uses a requirements.txt file to manage all necessary libraries. Run the following command to install them:
pip install -r requirements.txt
5. Create and Configure the .env File
The .env file is used to securely store environment variables and sensitive information like API keys.
-
In the project's root directory, create a new file named
.env. -
Open the
.envfile and add your Google Gemini API key:
GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY_HERE"
Note: Replace "YOUR_GOOGLE_API_KEY_HERE" with your actual API key.
5. Running the Application After completing all setup steps, run a single command in your terminal to launch the application:
python app.py
This command will perform two actions:
-
It starts the FastAPI backend server at http://127.0.0.1:8001.
-
It launches the Gradio frontend interface.
After running the command, the terminal will display a local URL (usually http://127.0.0.1:7860). Open this URL in your web browser to start using the chatbot.