Building a Poetry Guessing Game in Streamlit

· Source: Naturallanguageprocessing on Medium · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering, Data Science & Analytics · Depth: Intermediate, short

Summary

A developer created and deployed a "Poetry Guessing Game" web application using Streamlit, based on a previously trained recurrent neural network (RNN) model. The game challenges users to identify a poem's author from a single line, with the AI model also making a guess. It features two modes: "Standard mode," where both human and AI guess authors over 10 attempts, and "Alternate mode," which incorporates a betting system based on confidence levels for both players. The development process involved learning Streamlit, refining the existing LSTM model by correcting data errors (e.g., duplicate authors, non-English text, short lines) which improved accuracy by a few percent, writing the Streamlit app with Copilot's assistance, and implementing a betting strategy for the AI using the Kelly Betting System. The app was tested locally and deployed to Streamlit Community Cloud, requiring a `requirements.txt` file and relativized data sources.

Key takeaway

For MLOps Engineers looking to quickly prototype and deploy interactive machine learning applications, Streamlit offers a user-friendly framework. You should consider using AI coding assistants like Copilot to accelerate development and implement caching strategies for improved performance, especially when dealing with larger models or datasets. Ensure proper dependency management via `requirements.txt` and relative data paths for seamless cloud deployment.

Key insights

Streamlit enables rapid deployment of machine learning models into interactive web applications.

Principles

Method

Develop an ML model, clean its dataset, learn Streamlit, build the app, implement AI betting logic, test, and deploy to Streamlit Community Cloud with `requirements.txt` and relativized data paths.

In practice

Topics

Best for: Machine Learning Engineer, MLOps Engineer, Software Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Naturallanguageprocessing on Medium.