stf_model / README.md
andres.salguero
Add Hugging Face Spaces configuration
e4db522
metadata
title: Bayesian Token Co-occurrence Simulator
emoji: 🧮
colorFrom: blue
colorTo: indigo
sdk: docker
sdk_version: 3.0.0
app_file: app.py
pinned: false

Bayesian Token Co-occurrence Simulator

A Streamlit application that simulates and visualizes token co-occurrence patterns using Bayesian methods.

Local Development Setup

  1. Create and activate a virtual environment:
# Create virtual environment
python -m venv venv

# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
.\venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
streamlit run app.py

The application will be available at http://localhost:8501

Docker Setup

  1. Build the Docker image:
docker build -t bayesian-token-simulator .
  1. Run the Docker container:
docker run -p 8501:8501 bayesian-token-simulator

The application will be available at http://localhost:8501

Hugging Face Spaces Deployment

  1. Clone your Hugging Face Space repository:
git clone https://huggingface.co/spaces/afscomercial/stf_model
  1. Copy your project files to the cloned repository:
cp -r app.py requirements.txt Dockerfile .huggingfaceignore stf_model/
  1. Push the changes to Hugging Face:
cd stf_model
git add .
git commit -m "Add Bayesian Token Co-occurrence Simulator"
git push

Your application will be automatically deployed to https://huggingface.co/spaces/afscomercial/stf_model

Project Structure

  • app.py: Main Streamlit application
  • requirements.txt: Python dependencies
  • Dockerfile: Docker configuration
  • .gitignore: Git ignore rules
  • .huggingfaceignore: Hugging Face ignore rules

Features

  • Interactive text input for training sentences
  • Bayesian smoothing parameter adjustment
  • Co-occurrence matrix visualization
  • Next token prediction
  • Real-time updates

Requirements

  • Python 3.8+
  • Streamlit
  • NumPy
  • Pandas
  • Matplotlib
  • Seaborn
  • NLTK