GithubHelp home page GithubHelp logo

melanie531 / falcon-document-chatbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marshmellow77/falcon-document-chatbot

0.0 0.0 0.0 422 KB

A repo for a document chatbot that uses the Falcon model

License: MIT License

Python 24.20% Jupyter Notebook 74.44% Dockerfile 1.35%

falcon-document-chatbot's Introduction

falcon-document-chatbot

A repo for a document chatbot that uses the Falcon model

alt text

Architecture diagram for SageMaker implementation

The key advantage with this implementation is that no data ever leaves your AWS account. The model is hosted in a SageMaker endpoint in your account and all inference requests will be sent to that endpoint. alt text

How to run the application locally

  1. Install the required packages for this application with pip install -r requirements.txt. To avoid conflicts with existing python dependencies, it is best to do so in a virtual environment:
    $python3 -m venv .venv
    $source .venv/bin/activate
    $pip3 install -r requirements.txt
  2. You will need a SageMaker endpoint with the Falcon model deployed in your account. If you don't have, one you can use this notebook to deploy it in your account.
  3. (optional) Amend the chatbot.py file so that it points to your endpoint (variable endpoint_name)
  4. Run the app with streamlit run chatbot.py
  5. Upload a text file (e.g. Amazon's Q1 results)
  6. Start chatting ๐Ÿค—

Running Streamlit apps in SageMaker Studio

If you want to run Streamlit apps directly in SM Studio, you can do so with command streamlit run chatbot.py --server.port 6006. Once the app has started you can go to https://<YOUR_STUDIO_ID>.studio.<YOUR_REGION>.sagemaker.aws/jupyter/default/proxy/6006/ to launch the app.

Running the app in a docker container

Another way to use this application is creating and running a docker image using the Dockerfile.

You can create the docker image with this command

docker build --tag chatbot_image .

Then you can run the application with the following command:

docker run -v ~/.aws:/root/.aws -p 8501:8501 chatbot_image

The flag -v allows you to bind mount your AWS credentials file from your host into the Docker container. This command tells Docker to mount the ~/.aws directory from your host machine into the /root/.aws directory in the Docker container. AWS SDKs will look for the credentials file in this location.

The format is -p <host_port>:<container_port>. If your application inside Docker listens on port 8501, for instance, and you want to access it via port 8501 on your host machine, you'd use -p 8501:8501.

Access Your Application:

If your Docker container is running a web application, you should now be able to access it in a web browser at localhost:8501 (or whatever host port you used).

falcon-document-chatbot's People

Contributors

marshmellow77 avatar melanie531 avatar

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.