OpenArch AI

v1.0.0
Home
Measure
Wall
Door
Window
Furniture
View
3D View
Scale:
Current Level: Ground Floor
numpy pandas scikit-learn gradio import numpy as np import gradio as gr from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error import pandas as pd import json # Sample architectural data (in reality, this would come from your canvas) sample_data = { "room_sizes": [20, 30, 15, 25, 40], "window_count": [2, 3, 1, 2, 4], "door_count": [1, 2, 1, 1, 2], "natural_light": [0.7, 0.8, 0.5, 0.6, 0.9], "energy_efficiency": [0.75, 0.85, 0.65, 0.7, 0.95] } df = pd.DataFrame(sample_data) # Prepare data for ML model X = df[["room_sizes", "window_count", "door_count"]] y = df[["natural_light", "energy_efficiency"]] # Split data X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) # Train model model = RandomForestRegressor(n_estimators=100, random_state=42) model.fit(X_train, y_train) # Evaluate y_pred = model.predict(X_test) mse = mean_squared_error(y_test, y_pred) print(f"Model MSE: {mse}") def predict_design(room_size, window_count, door_count): """Predict natural light and energy efficiency for a room design""" input_data = np.array([[room_size, window_count, door_count]]) prediction = model.predict(input_data) natural_light = round(float(prediction[0][0]), 2) energy_efficiency = round(float(prediction[0][1]), 2) # Generate architectural advice based on predictions advice = [] if natural_light < 0.5: advice.append("Consider adding more windows or increasing window size for better natural light.") elif natural_light > 0.8: advice.append("Excellent natural light! Consider adding shading elements if needed.") if energy_efficiency < 0.7: advice.append("Recommend improving insulation or using energy-efficient materials.") elif energy_efficiency > 0.85: advice.append("Great energy efficiency! Consider adding renewable energy sources.") return { "Natural Light Score": natural_light, "Energy Efficiency Score": energy_efficiency, "Recommendations": advice } def analyze_design(design_data): """Analyze the current architectural design""" try: design = json.loads(design_data) # In a real app, this would analyze the actual design elements # For demo, we'll use sample values total_area = sum([room['area'] for room in design.get('rooms', [{'area': 25}])]) window_count = design.get('window_count', 2) door_count = design.get('door_count', 1) result = predict_design(total_area, window_count, door_count) # Format the response response = f"""

Design Analysis Results

Total Area: {total_area} m²

Natural Light Score: {result['Natural Light Score']}/1.0

Energy Efficiency Score: {result['Energy Efficiency Score']}/1.0

Recommendations:

    {''.join([f'
  • {item}
  • ' for item in result['Recommendations']]) if result['Recommendations'] else '
  • No major recommendations. Design looks good!
  • '}
""" return response except Exception as e: return f"Error analyzing design: {str(e)}" # Create Gradio interface with gr.Blocks() as demo: gr.Markdown("## OpenArch AI Assistant") gr.Markdown("Get real-time feedback on your architectural designs") with gr.Row(): with gr.Column(): room_size = gr.Slider(10, 100, value=25, label="Room Size (m²)") window_count = gr.Slider(1, 5, value=2, step=1, label="Window Count") door_count = gr.Slider(1, 3, value=1, step=1, label="Door Count") predict_btn = gr.Button("Predict Performance") with gr.Column(): output = gr.JSON(label="Prediction Results") predict_btn.click( fn=predict_design, inputs=[room_size, window_count, door_count], outputs=output ) with gr.Accordion("Analyze Current Design", open=False): design_input = gr.Textbox(json.dumps({ "rooms": [{"area": 25}, {"area": 15}], "window_count": 3, "door_count": 2 }), label="Design Data (JSON)", visible=False) analyze_btn = gr.Button("Analyze Design") analysis_output = gr.HTML() analyze_btn.click( fn=analyze_design, inputs=design_input, outputs=analysis_output ) demo.launch()
X: 1250 Y: 780
Scale: 1:100

Properties

mm
mm
mm

AI Suggestions

Based on your current design, our AI recommends:
  • Consider adding a window to the north wall for better lighting
  • Add fire-rated materials to the kitchen walls
  • This layout scores 82/100 for energy efficiency

Layers

Walls
Doors
Windows
Furniture
Electrical

Made with DeepSite LogoDeepSite - 🧬 Remix