Replicate the app from the image.
To upload files, please first save the app
import streamlit as st
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
st.title("Floor Plan Viewer")
st.write("Korean Apartment Floor Plan")
# Create figure and axis
fig, ax = plt.subplots(1, 1, figsize=(14, 10))
# Define colors
living_color = '#F4E4BC' # Light beige for living areas
kitchen_color = '#D4A574' # Orange-brown for kitchen
bathroom_color = '#E8E8E8' # Light gray for bathrooms
balcony_color = '#F0F0F0' # Very light gray for balcony
# Main apartment outline
main_outline = patches.Rectangle((0, 0), 13.5, 10, linewidth=3, edgecolor='black', facecolor='none')
ax.add_patch(main_outline)
# Living room (거실) - main central area
living_room = patches.Rectangle((3.5, 3), 6, 4.5, linewidth=2, edgecolor='black', facecolor=living_color)
ax.add_patch(living_room)
# Kitchen (주방) - upper right
kitchen = patches.Rectangle((9.5, 6.5), 2.5, 1.87, linewidth=2, edgecolor='black', facecolor=kitchen_color)
ax.add_patch(kitchen)
# Bedroom 1 (침실) - upper left
bedroom1 = patches.Rectangle((1, 6.5), 2.96, 2.5, linewidth=2, edgecolor='black', facecolor=living_color)
ax.add_patch(bedroom1)
# Bedroom 2 (침실) - right side
bedroom2 = patches.Rectangle((10.5, 3.5), 2.5, 2.65, linewidth=2, edgecolor='black', facecolor=living_color)
ax.add_patch(bedroom2)
# Bedroom 3 (침실) - bottom right
bedroom3 = patches.Rectangle((9.5, 1), 2.85, 2.5, linewidth=2, edgecolor='black', facecolor=living_color)
ax.add_patch(bedroom3)
# Bathroom 1 - top
bathroom1 = patches.Rectangle((4, 8.3), 2, 1.2, linewidth=2, edgecolor='black', facecolor=bathroom_color)
ax.add_patch(bathroom1)
# Bathroom 2 - right side
bathroom2 = patches.Rectangle((9.5, 4.5), 1.5, 1.5, linewidth=2, edgecolor='black', facecolor=bathroom_color)
ax.add_patch(bathroom2)
# Balcony (발코니) - left side angled
balcony_points = np.array([[0, 4], [0, 9], [1.5, 9], [3, 7], [3, 4]])
balcony = patches.Polygon(balcony_points, linewidth=2, edgecolor='black', facecolor=balcony_color)
ax.add_patch(balcony)
# Storage/utility areas
storage1 = patches.Rectangle((3.5, 7.5), 1.5, 1.5, linewidth=2, edgecolor='black', facecolor=bathroom_color)
ax.add_patch(storage1)
storage2 = patches.Rectangle((12, 6.5), 1.5, 1.5, linewidth=2, edgecolor='black', facecolor=bathroom_color)
ax.add_patch(storage2)
# Add room labels with Korean text
ax.text(6.5, 5.5, '거실\n43.72', ha='center', va='center', fontsize=12, weight='bold')
ax.text(2.5, 8, '침실\n12.96', ha='center', va='center', fontsize=10)
ax.text(11.5, 5, '침실\n13.85', ha='center', va='center', fontsize=10)
ax.text(11, 2, '침실\n13.85', ha='center', va='center', fontsize=10)
ax.text(10.7, 7.4, '주방\n11.87', ha='center', va='center', fontsize=10)
ax.text(1.5, 6.5, '발코니', ha='center', va='center', fontsize=10, rotation=45)
# Add dimension lines and measurements
# Top dimensions
ax.annotate('', xy=(0, 10.5), xytext=(3.3, 10.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(1.65, 10.7, '3300', ha='center', va='bottom', fontsize=8)
ax.annotate('', xy=(3.3, 10.5), xytext=(6, 10.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(4.65, 10.7, '3300', ha='center', va='bottom', fontsize=8)
ax.annotate('', xy=(6, 10.5), xytext=(9.5, 10.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(7.75, 10.7, '3900', ha='center', va='bottom', fontsize=8)
ax.annotate('', xy=(9.5, 10.5), xytext=(12, 10.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(10.75, 10.7, '3600', ha='center', va='bottom', fontsize=8)
ax.annotate('', xy=(12, 10.5), xytext=(13.5, 10.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(12.75, 10.7, '1350', ha='center', va='bottom', fontsize=8)
ax.annotate('', xy=(13.5, 10.5), xytext=(13.5, 10.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(13.5, 10.7, '1350', ha='center', va='bottom', fontsize=8)
# Side dimensions
ax.annotate('', xy=(-0.5, 0), xytext=(-0.5, 3), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(-0.7, 1.5, '1500', ha='center', va='center', fontsize=8, rotation=90)
ax.annotate('', xy=(-0.5, 3), xytext=(-0.5, 6), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(-0.7, 4.5, '3600', ha='center', va='center', fontsize=8, rotation=90)
ax.annotate('', xy=(-0.5, 6), xytext=(-0.5, 10), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(-0.7, 8, '2100', ha='center', va='center', fontsize=8, rotation=90)
# Bottom dimensions
ax.annotate('', xy=(0, -0.5), xytext=(2, -0.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(1, -0.7, '2005', ha='center', va='top', fontsize=8)
ax.annotate('', xy=(2, -0.5), xytext=(4, -0.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(3, -0.7, '2006', ha='center', va='top', fontsize=8)
ax.annotate('', xy=(4, -0.5), xytext=(10, -0.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(7, -0.7, '6000', ha='center', va='top', fontsize=8)
ax.annotate('', xy=(10, -0.5), xytext=(13.3, -0.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(11.65, -0.7, '3300', ha='center', va='top', fontsize=8)
ax.annotate('', xy=(13.3, -0.5), xytext=(13.5, -0.5), arrowprops=dict(arrowstyle='<->', color='black'))
ax.text(13.4, -0.7, '4200', ha='center', va='top', fontsize=8)
# Add area information at bottom
area_text = "전용: 186.66, 공급: 33.49, 발판: 219.57, 세대수: 30.91, 주차장: 32.93"
ax.text(6.75, -1.5, area_text, ha='center', va='center', fontsize=10,
bbox=dict(boxstyle="round,pad=0.3", facecolor='white', edgecolor='gray'))
# Set axis properties
ax.set_xlim(-1.5, 15)
ax.set_ylim(-2, 12)
ax.set_aspect('equal')
ax.axis('off')
# Display the plot
st.pyplot(fig)
# Add some additional information
st.subheader("Room Information")
col1, col2, col3 = st.columns(3)
with col1:
st.write("**Living Areas:**")
st.write("• 거실 (Living Room): 43.72㎡")
st.write("• 침실 (Bedroom 1): 12.96㎡")
with col2:
st.write("**Bedrooms:**")
st.write("• 침실 (Bedroom 2): 13.85㎡")
st.write("• 침실 (Bedroom 3): 13.85㎡")
with col3:
st.write("**Other Areas:**")
st.write("• 주방 (Kitchen): 11.87㎡")
st.write("• 발코니 (Balcony)")
st.subheader("Apartment Specifications")
st.write("• **전용면적 (Exclusive Area):** 186.66㎡")
st.write("• **공급면적 (Supply Area):** 33.49㎡")
st.write("• **발판면적 (Balcony Area):** 219.57㎡")
st.write("• **세대수 (Number of Units):** 30.91")
st.write("• **주차장 (Parking):** 32.93㎡")
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?