This content originally appeared on DEV Community and was authored by A0mineTV
Designing clean, on-brand property posters is a recurring task for agents and property managers. This article walks you through a Streamlit app that produces professional real-estate posters with customizable templates, color schemes, and a downloadable high‑resolution PNG.
The full source code is available on GitHub: real_estate_generator.
What you’ll build
An interactive Streamlit app where you:
- Fill in property details (title, price, surface, rooms, address, agent contact)
- Choose among multiple visual styles and color palettes
- Upload photos and optionally include a QR code
- Preview the poster on the web and download a PNG optimized for A4 printing
Key features
- Four poster styles: Modern, Classic, Luxury, Minimalist
- Customization: Four color schemes, optional QR code, market stats
- Rich form: Required and optional fields, photo uploads
- Export: High‑resolution PNG (800×1200), suitable for print and web
Project structure
streamlit_mcp/
├── index.py # App entry point and page orchestration
├── forms.py # Form logic, validation, sidebar options
├── views.py # Streamlit-based templates for visual styles
├── utils.py # Image generation (PIL), QR codes, helpers
├── requirements.txt # Dependencies
└── README.md # Documentation
Getting started
pip install -r requirements.txt
streamlit run index.py
The app will be available at http://localhost:8501
.
Inside the code
This app is intentionally modular so you can tweak styles, add fields, or integrate new outputs.
1) index.py
: page setup and orchestration
- Configures the Streamlit page and global CSS
- Renders the sidebar options and market stats
- Displays the main form and validates required fields
- Generates the poster preview and provides a PNG download
At a high level, the flow looks like:
# Orchestration overview
options = afficher_sidebar_options()
afficher_statistiques_marche()
data, submit_button = afficher_formulaire_appartement()
if submit_button:
champs_manquants = valider_donnees_obligatoires(data)
if not champs_manquants:
afficher_resume_donnees(data)
generer_affiche(data, options)
When generating the poster, the app also surfaces useful metrics like total price, price per square meter, and counts of rooms.
2) forms.py
: form inputs and validation
The form is built with a Streamlit st.form
to group inputs and submit them as a single action. It includes:
- Required fields: title, price, surface, rooms, full address, agent name, phone
- Optional fields: bedrooms, bathrooms, building floor, features (elevator, balcony, parking, cellar), technical and financial info, description, photos, extra contact
Validation is handled by valider_donnees_obligatoires
, which checks presence and basic numeric validity for required fields. Photos are uploaded via st.file_uploader
with support for jpg
, jpeg
, png
, and webp
.
3) views.py
: visual templates
Each style is a dedicated function that renders a polished Streamlit layout with the provided data:
creer_affiche_moderne
creer_affiche_classique
creer_affiche_luxe
creer_affiche_minimaliste
They show the headline info first (title, property type, neighborhood/city, price) followed by features, location, contact, and an optional photo gallery. The result is an attractive, shareable poster directly inside the Streamlit app.
4) utils.py
: downloadable PNG generation and helpers
Beyond the on‑screen preview, the app can generate a downloadable PNG using Pillow (PIL):
-
generer_image_affiche(data, style, color_scheme)
: orchestrates drawing a poster on an 800×1200 canvas - Style‑specific drawing functions:
generer_style_moderne
,generer_style_classique
,generer_style_luxe
,generer_style_minimaliste
-
generer_qr_code(data)
: builds a QR code with contact details -
creer_bouton_telechargement(data)
: produces the PNG in‑memory and exposes a Streamlit download button - Utilities like
calculer_prix_m2
andgenerer_resume_bien
This dual approach (Streamlit preview + PIL image) ensures you can both showcase and export a high‑quality asset for print or digital use.
Usage walkthrough
- Fill in the property form with all the essential details
- Select a visual style and color scheme from the sidebar
- Add photos (the app will display a grid where relevant)
- Click “Générer l’affiche” to preview the poster
- Download the PNG from the “Download” section
Extending the project
Adding a new visual style is straightforward:
- Create a new template function in
views.py
- Add the style to the options in
forms.py
- Update the selection logic in
index.py
to render your new style
You can also tweak color palettes in utils.py
(get_color_config
) or add extra fields by updating the form and corresponding templates.
Why Streamlit?
Streamlit enables rapid, Python‑first UI development with very little boilerplate. It’s ideal for internal tools, marketing assets, and one‑off utilities like this poster generator. Coupled with Pillow for image export and qrcode
for contact sharing, you get a complete pipeline from data entry to polished output.
License and credits
The project is free to use for personal and professional purposes. Explore and adapt the code on GitHub: real_estate_generator.
This content originally appeared on DEV Community and was authored by A0mineTV