Giter VIP home page Giter VIP logo

kaifcoder / gemini_multipdf_chat Goto Github PK

View Code? Open in Web Editor NEW
84.0 1.0 74.0 10 KB

Gemini PDF Chatbot: A Streamlit-based application powered by the Gemini conversational AI model. Upload multiple PDF files, extract text, and engage in natural language conversations to receive detailed responses based on the document context. Enhance your interaction with PDF documents using this intuitive and intelligent chatbot.

Home Page: https://gmultichat.streamlit.app/

Python 73.53% Dockerfile 26.47%
gemini-api gemini-pro langchain llms rag

gemini_multipdf_chat's Introduction

Gemini PDF Chatbot

Gemini PDF Chatbot is a Streamlit-based application that allows users to chat with a conversational AI model trained on PDF documents. The chatbot extracts information from uploaded PDF files and answers user questions based on the provided context. https://gmultichat.streamlit.app/

gemini.multidocs.chat.demo.mp4

Features

  • PDF Upload: Users can upload multiple PDF files.
  • Text Extraction: Extracts text from uploaded PDF files.
  • Conversational AI: Uses the Gemini conversational AI model to answer user questions.
  • Chat Interface: Provides a chat interface to interact with the chatbot.

Getting Started

If you have docker installed, you can run the application using the following command:

  • Obtain a Google API key and set it in the .env file.

    GOOGLE_API_KEY=your_api_key_here
docker compose up --build

Your application will be available at http://localhost:8501.

Deploying your application to the cloud

First, build your image, e.g.: docker build -t myapp .. If your cloud uses a different CPU architecture than your development machine (e.g., you are on a Mac M1 and your cloud provider is amd64), you'll want to build the image for that platform, e.g.: docker build --platform=linux/amd64 -t myapp ..

Then, push it to your registry, e.g. docker push myregistry.com/myapp.

Consult Docker's getting started docs for more detail on building and pushing.

References

Local Development

Follow these instructions to set up and run this project on your local machine.

Note: This project requires Python 3.10 or higher.

  1. Clone the Repository:

    git clone https://github.com/your-username/gemini-pdf-chatbot.git
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Set up Google API Key:

    • Obtain a Google API key and set it in the .env file.
    GOOGLE_API_KEY=your_api_key_here
  4. Run the Application:

    streamlit run main.py
  5. Upload PDFs:

    • Use the sidebar to upload PDF files.
    • Click on "Submit & Process" to extract text and generate embeddings.
  6. Chat Interface:

    • Chat with the AI in the main interface.

Project Structure

  • app.py: Main application script.
  • .env: file which will contain your environment variable.
  • requirements.txt: Python packages required for working of the app.
  • README.md: Project documentation.

Dependencies

  • PyPDF2
  • langchain
  • Streamlit
  • google.generativeai
  • dotenv

Acknowledgments

gemini_multipdf_chat's People

Contributors

dribo avatar kaifcoder avatar tifcode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gemini_multipdf_chat's Issues

Implementation of API to use this service with external frontend

Summary
We currently lack an API for seamless integration with external frontends, hindering users who wish to utilize our service in conjunction with their own interfaces. This issue aims to address this limitation by implementing a robust API, facilitating easier access and interaction with our service from external applications.

Background
As our service gains traction, we've received numerous requests from users wanting to integrate our functionalities into their own frontend applications. However, without a dedicated API, achieving this integration is challenging and often requires cumbersome workarounds.

Proposed Solution
To resolve this issue, we propose developing and implementing a comprehensive API that allows external frontends to interact with our service effortlessly. This API should encompass endpoints for various functionalities, ensuring flexibility and compatibility with a wide range of frontend frameworks and programming languages.

Expected Features

  • Authentication Mechanism: Implement secure authentication methods to verify the identity of users accessing the API.
  • RESTful Endpoints: Design RESTful endpoints for seamless interaction with our service, enabling CRUD operations where applicable.
  • Error Handling: Implement robust error handling mechanisms to provide informative error messages in case of failures or invalid requests.
  • Documentation: Provide thorough documentation detailing the usage of each API endpoint, including sample requests and responses.
  • Scalability and Performance: Ensure the API is designed to handle high volumes of requests efficiently, maintaining responsiveness even during peak usage periods.
  • Versioning: Implement versioning to support backward compatibility and facilitate future updates without disrupting existing integrations.

Impact

  • Improved Accessibility: Enable users to integrate our service seamlessly into their own frontends, enhancing accessibility and usability.
  • Expanded User Base: Attract developers and businesses seeking to leverage our service within their applications, potentially expanding our user base.
  • Enhanced User Experience: Empower users to tailor their frontend experiences according to their unique requirements, fostering greater satisfaction and engagement.

Additional Considerations

  • Security: Prioritize security throughout the API development process to safeguard sensitive data and prevent unauthorized access.
  • Feedback Mechanism: Establish a channel for users to provide feedback and suggestions regarding the API, facilitating continuous improvement and refinement.

doesnt work

log:

/usr/local/lib/python3.11/site-packages/langchain/vectorstores/init.py:35: LangChainDeprecationWarning: Importing vector stores from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:

from langchain_community.vectorstores import FAISS.

To install langchain-community run pip install -U langchain-community.
warnings.warn(
2024-02-19 18:53:00.909 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
exec(code, module.dict)
File "/app/app.py", line 144, in
main()
File "/app/app.py", line 131, in main
response = user_input(prompt)
^^^^^^^^^^^^^^^^^^
File "/app/app.py", line 76, in user_input
new_db = FAISS.load_local("faiss_index", embeddings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/langchain_community/vectorstores/faiss.py", line 1110, in load_local
index = faiss.read_index(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/faiss/swigfaiss_avx2.py", line 10206, in read_index
return _swigfaiss_avx2.read_index(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error in faiss::FileIOReader::FileIOReader(const char
) at /project/faiss/faiss/impl/io.cpp:67: Error: 'f' failed: could not open faiss_index/index.faiss for reading: No such file or directory

it is not working for me, but why?

whenever i ask something, it says "This context does not mention anything about signs, symptoms and presentations in emergency medicine field, so I cannot extract the requested data from the provided context."

i think it can't see the pdf's i uploaded.

But upload process is successfull.

Please help.

Screenshot 2024-02-14 211035

RuntimeError: Error in faiss::FileIOReader::FileIOReader(const char *) at /Users/runner/work/faiss-wheels/faiss-wheels/faiss/faiss/impl/io.cpp:68: Error: 'f' failed: could not open faiss_index/index.faiss for reading: No such file or directory

Hi, I've an error;

RuntimeError: Error in faiss::FileIOReader::FileIOReader(const char *) at /Users/runner/work/faiss-wheels/faiss-wheels/faiss/faiss/impl/io.cpp:68: Error: 'f' failed: could not open faiss_index/index.faiss for reading: No such file or directory

can you help me?

Thxz!

PermissionError: [Errno 13] Permission denied: 'faiss_index'

I used a Docker image, but it's giving an error. I'm getting the following error

image

PermissionError: [Errno 13] Permission denied: 'faiss_index'
Traceback:
File "/usr/local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
exec(code, module.dict)
File "/app/app.py", line 144, in
main()
File "/app/app.py", line 103, in main
get_vector_store(text_chunks)
File "/app/app.py", line 44, in get_vector_store
vector_store.save_local("faiss_index")
File "/usr/local/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 1078, in save_local
path.mkdir(exist_ok=True, parents=True)
File "/usr/local/lib/python3.10/pathlib.py", line 1173, in mkdir
self._accessor.mkdir(self, mode)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.