Skip to content

mihail911/question-answering-with-streamlit

Repository files navigation

State-of-the-art Question Answering With Streamlit and HuggingFace

This is the code accompanying this post. You can try the app here. Built using Streamlit and deployed on Heroku

Note: Heroku app is deployed using tensorflow framework, which doesn't play nicely with streamlit caching. For best experiences use pytorch framework. I have added a conditional decorator to avoid model reloading & effecient caching. However, the slug size for pytorch is above 850MB which far exceeds heroku's allowed slug size (500MB).

qa_streamlit

Libraries Used

  • Transformers
  • Streamlit

Running Locally

All the experiments are run on python 3.8.0.

  1. Clone the repository
  2. If you do not have python3.8 installed. Run the below steps for easy installation using asdf. asdf allows us to manage multiple runtime versions such for different languages such as nvm, rbenv, pyenv, etc using a CLI tool
    • Install asdf using this guide
    • Now install python3.8.0
    asdf plugin add python
    asdf install python 3.8.0
    asdf local python 3.8.0	# sets python3.8 as interpreter for the project
    • Check the set python version
    asdf current python
  3. Install poetry. Poetry is a python dependency management & packaging tool. Allows us to declare project libraries dependency & manage them
    asdf plugin add poetry
    asdf install poetry latest # current 1.0.10; might need sudo
    asdf local poetry 1.0.10
  4. Install all dependencies
    poetry install
  5. (Optional) Explicitly instantiate the env
    source "$( poetry env list --full-path | grep Activated | cut -d' ' -f1 )/bin/activate"
  6. To run the application -
    streamlit run app.py
  7. Change config dictionary values in config.py as required
framework: tf/pt # choose tensorflow or pytorch framework
NUM_SENT: int # number of wiki sentences for context

About

State-of-the-art question answering with HuggingFace and Streamlit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published