Skip to content

Added Streamlit autocomplete UI for bigram name generation#32

Open
amit03wit wants to merge 2 commits into
karpathy:masterfrom
amit03wit:master
Open

Added Streamlit autocomplete UI for bigram name generation#32
amit03wit wants to merge 2 commits into
karpathy:masterfrom
amit03wit:master

Conversation

@amit03wit

Copy link
Copy Markdown

Summary
This PR adds a lightweight web UI (bigram_autocomplete.py) that lets users interact with the bigram model in real time. As the user types, the app shows the top 5 most likely next characters based on the bigram transition probabilities learned from names.txt.

Motivation
The notebook currently generates full names from the bigram model, but there is no interactive way to explore the learned character-by-character transitions. This UI makes the model more intuitive to understand and demo.

Changes

  1. Added bigram_autocomplete.py in the project root
  2. Loads names.txt, builds the same 27 × 27 bigram count matrix, and converts it to probabilities
  3. Provides a text input that uses the last typed character as context
  4. Displays the top 5 predicted next characters with their probabilities

How to run

pip install streamlit torch
streamlit run bigram_autocomplete.py

UI

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant