CoolFace
Apppublic

anakin87/who-killed-laura-palmer

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
16likes
App README

Who killed Laura Palmer?   ![Generic badge](https://huggingface.co/spaces/anakin87/who-killed-laura-palmer) ![Generic badge](https://github.com/anakin87/who-killed-laura-palmer)

<img src="./data/readme_images/spaces_logo.png" align="center" style="display: block;margin-left: auto; margin-right: auto; max-width: 70%;}">

๐Ÿ—ป๐Ÿ—ป Twin Peaks Question Answering system

WKLP is a simple Question Answering system, based on data crawled from Twin Peaks Wiki. It is built using ๐Ÿ” Haystack, an awesome open-source framework for building search systems that work intelligently over large document collections.

Project architecture ๐Ÿงฑ

![Project architecture](#)


What can I learn from this project? ๐Ÿ“š

  • โ€”How to quickly โŒš build a modern Question Answering system using ๐Ÿ” Haystack
  • โ€”How to generate questions based on your documents
  • โ€”How to build a nice Streamlit web app to show your QA system
  • โ€”How to optimize the web app to ๐Ÿš€ deploy in ๐Ÿค— Spaces

![Web app preview](https://huggingface.co/spaces/anakin87/who-killed-laura-palmer)

Repository structure ๐Ÿ“

  • โ€”app.py: Streamlit web app
  • โ€”app_utils folder: python modules used in the web app
  • โ€”crawler folder: Twin Peaks crawler, developed with Scrapy and fandom-py
  • โ€”notebooks folder: Jupyter/Colab notebooks to create the Search pipeline and generate questions (using Haystack)
  • โ€”data folder: all necessary data
  • โ€”presentations: Video presentation and slides (PyCon Italy 2022)

Within each folder, you can find more in-depth explanations.

Installation ๐Ÿ’ป

To install this project locally, follow these steps:

  • โ€”git clone https://github.com/anakin87/who-killed-laura-palmer
  • โ€”cd who-killed-laura-palmer
  • โ€”pip install -r requirements.txt

To run the web app, simply type: streamlit run app.py

Possible improvements โœจ

Project structure

  • โ€”The project is optimized to be deployed in Hugging Face Spaces and consists of an all-in-one Streamlit web app. In more structured production environments, I suggest dividing the software into three parts:
  • โ€”Haystack backend API (as explained in the official documentation)
  • โ€”Document store service
  • โ€”Streamlit web app

Reader

  • โ€”The reader model (deepset/roberta-base-squad2) is a good compromise between speed and accuracy, running on CPU. There are certainly better (and more computationally expensive) models, as you can read in the Haystack documentation.
  • โ€”You can also think about preparing a Twin Peaks QA dataset and fine-tuning the reader model to get better accuracy, as explained in this Haystack tutorial.