DEV Community

Pranav Munigala
Pranav Munigala

Posted on

NBA Random Fact Generator

Hey everyone,

I'm currently learning the basics of AI tools and web app development, and I decided to build something that combines both with one of my favorite interests: basketball.

I created a simple Random NBA Fact Generator using Streamlit and LangChain (with OpenAI’s GPT-3.5 Turbo Instruct model). The app generates a new, true, and concise NBA fact each time you click a button. It also avoids repeating the same fact twice in a row.

How it works:
The app sends a prompt to the LLM:
“Give me one interesting, true, and concise NBA fact. Only return the fact, nothing else.”

I use a temperature of 0.7 to allow for some variation in responses.

Streamlit provides a basic UI, and I use session state to store the previous fact and prevent duplicates.

Why I built this:
I'm exploring how to use Python, AI libraries, and web app frameworks together. Building small, fun projects like this helps reinforce what I'm learning. Since I love basketball, this was a great way to keep things interesting while practicing new tools.

Here is a link to show how the program works: https://youtu.be/7hNdoaspY1A

Top comments (0)