stf_model / README.md
andres.salguero
Add Hugging Face Spaces configuration
e4db522
---
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:
```bash
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
.\venv\Scripts\activate
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Run the application:
```bash
streamlit run app.py
```
The application will be available at http://localhost:8501
## Docker Setup
1. Build the Docker image:
```bash
docker build -t bayesian-token-simulator .
```
2. Run the Docker container:
```bash
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:
```bash
git clone https://huggingface.co/spaces/afscomercial/stf_model
```
2. Copy your project files to the cloned repository:
```bash
cp -r app.py requirements.txt Dockerfile .huggingfaceignore stf_model/
```
3. Push the changes to Hugging Face:
```bash
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