File size: 2,036 Bytes
e4db522
 
 
 
 
 
 
 
 
 
 
5f21106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
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