CoolFace
Apppublic

sundaloo/streamlit_history_chatbot

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
App README

Singapore History Assistant

A Streamlit application that uses a fine-tuned Phi-3.5 Mini model with RAG (Retrieval-Augmented Generation) to answer questions about Singapore's history.

Features

  • —Fine-tuned Language Model: Uses a Phi-3.5 Mini model specifically trained on Singapore history content
  • —RAG System: Enhances answers with relevant context retrieved from a vector database of Singapore historical documents
  • —Question Classification: Filters out questions not related to Singapore history
  • —User-friendly Interface: Simple, intuitive Streamlit interface

Setup Instructions

Prerequisites

  • —Python 3.8+
  • —pip package manager

Installation

  1. 1.Clone this repository:
   git clone https://huggingface.co/spaces/[your-username]/singapore-history-assistant
   cd singapore-history-assistant
  1. 1.Install the required dependencies:
   pip install -r requirements.txt
  1. 1.Extract the vector store archive:
   mkdir -p sg_history_vectordb
   tar -xzvf archive.zip -C sg_history_vectordb
  1. 1.Make sure the model files are correctly placed:
   mkdir -p phi-trained-sg-hist
   tar -xzvf phi-trained-sg-hist-pytorch-default-v1.tar.gz -C phi-trained-sg-hist

Running the App

Run the Streamlit app with:

streamlit run app.py

Usage

  1. 1.Enter your question about Singapore history in the input box
  2. 2.Click the "Ask" button or press Enter
  3. 3.The assistant will retrieve relevant information and generate a response

Example Questions

  • —Who was Sir Stamford Raffles?
  • —What happened during the Japanese Occupation of Singapore?
  • —How did Singapore gain independence?
  • —What role did Lee Kuan Yew play in Singapore's development?
  • —What was the significance of the merger with Malaysia?

Notes

  • —The application will only respond to questions related to Singapore history
  • —For questions outside this domain, the system will prompt you to ask about Singapore history instead
  • —The first run may take a few minutes to load the model and vector store

Deployment

This app is designed to be deployable on Hugging Face Spaces. Simply upload the files to your Hugging Face Space repository.

Technical Details

  • —Language Model: Fine-tuned Phi-3.5 Mini with PEFT/LoRA adapters
  • —Embeddings: sentence-transformers/all-MiniLM-L6-v2
  • —Vector Database: Chroma
  • —Interface: Streamlit