File size: 5,603 Bytes
8b8c9d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
"""

Demo script for BuildTheFuture application

Creates sample construction images and demonstrates the application

"""

import os
import sys
from PIL import Image, ImageDraw, ImageFont
import numpy as np
import random

def create_sample_construction_images():
    """Create sample construction site images for demonstration"""
    
    # Create samples directory
    os.makedirs("samples", exist_ok=True)
    
    # Sample 1: Incomplete building
    create_incomplete_building("samples/building_construction.jpg")
    
    # Sample 2: Bridge construction
    create_bridge_construction("samples/bridge_construction.jpg")
    
    # Sample 3: Road construction
    create_road_construction("samples/road_construction.jpg")
    
    print("βœ… Sample construction images created in 'samples' directory")

def create_incomplete_building(filename):
    """Create an image of an incomplete building"""
    width, height = 600, 400
    img = Image.new('RGB', (width, height), color=(135, 206, 235))  # Sky blue background
    
    draw = ImageDraw.Draw(img)
    
    # Ground
    draw.rectangle([0, height-100, width, height], fill=(139, 69, 19))  # Brown ground
    
    # Foundation (completed)
    draw.rectangle([100, height-200, 500, height-100], fill=(105, 105, 105))  # Gray foundation
    
    # Incomplete walls (only partially built)
    draw.rectangle([120, height-300, 200, height-200], fill=(192, 192, 192))  # Left wall
    draw.rectangle([300, height-250, 380, height-200], fill=(192, 192, 192))  # Right wall
    
    # Steel beams (exposed)
    for i in range(5):
        x = 150 + i * 60
        draw.rectangle([x, height-350, x+10, height-200], fill=(64, 64, 64))  # Steel beams
    
    # Construction equipment
    draw.rectangle([50, height-150, 80, height-120], fill=(255, 165, 0))  # Crane base
    draw.line([65, height-150, 65, height-250], fill=(255, 165, 0), width=3)  # Crane mast
    
    # Add some construction debris
    for _ in range(10):
        x = random.randint(0, width)
        y = random.randint(height-100, height-50)
        draw.ellipse([x, y, x+10, y+10], fill=(128, 128, 128))
    
    img.save(filename)
    print(f"Created: {filename}")

def create_bridge_construction(filename):
    """Create an image of an incomplete bridge"""
    width, height = 600, 400
    img = Image.new('RGB', (width, height), color=(135, 206, 235))  # Sky blue
    
    draw = ImageDraw.Draw(img)
    
    # Water
    draw.rectangle([0, height-150, width, height], fill=(0, 100, 200))  # Blue water
    
    # Bridge supports (completed)
    draw.rectangle([150, height-300, 180, height-150], fill=(105, 105, 105))  # Left support
    draw.rectangle([420, height-300, 450, height-150], fill=(105, 105, 105))  # Right support
    
    # Bridge deck (incomplete - missing middle section)
    draw.rectangle([100, height-320, 200, height-300], fill=(192, 192, 192))  # Left deck
    draw.rectangle([400, height-320, 500, height-300], fill=(192, 192, 192))  # Right deck
    
    # Missing middle section (just steel beams)
    for i in range(8):
        x = 200 + i * 25
        draw.rectangle([x, height-330, x+5, height-300], fill=(64, 64, 64))  # Steel beams
    
    # Construction equipment
    draw.rectangle([300, height-200, 330, height-170], fill=(255, 0, 0))  # Construction vehicle
    
    img.save(filename)
    print(f"Created: {filename}")

def create_road_construction(filename):
    """Create an image of an incomplete road"""
    width, height = 600, 400
    img = Image.new('RGB', (width, height), color=(135, 206, 235))  # Sky blue
    
    draw = ImageDraw.Draw(img)
    
    # Ground
    draw.rectangle([0, height-200, width, height], fill=(34, 139, 34))  # Green ground
    
    # Completed road sections
    draw.rectangle([0, height-150, 200, height-100], fill=(64, 64, 64))  # Left road
    draw.rectangle([400, height-150, width, height-100], fill=(64, 64, 64))  # Right road
    
    # Incomplete middle section (gravel/dirt)
    draw.rectangle([200, height-150, 400, height-100], fill=(139, 69, 19))  # Dirt/gravel
    
    # Construction equipment
    draw.rectangle([250, height-200, 280, height-170], fill=(255, 255, 0))  # Excavator
    draw.rectangle([350, height-200, 380, height-170], fill=(255, 0, 0))  # Dump truck
    
    # Road barriers
    for i in range(3):
        x = 180 + i * 60
        draw.rectangle([x, height-180, x+20, height-150], fill=(255, 255, 0))  # Barriers
    
    img.save(filename)
    print(f"Created: {filename}")

def run_demo():
    """Run a demonstration of the application"""
    print("πŸ—οΈ  BuildTheFuture Demo")
    print("=" * 50)
    
    # Create sample images
    create_sample_construction_images()
    
    print("\nπŸ“ Sample images created:")
    print("   - samples/building_construction.jpg")
    print("   - samples/bridge_construction.jpg") 
    print("   - samples/road_construction.jpg")
    
    print("\nπŸš€ To run the application:")
    print("   1. Set up your API keys in .env file")
    print("   2. Run: python app.py")
    print("   3. Upload one of the sample images")
    print("   4. Select a completion style")
    print("   5. Click 'Complete Construction'")
    
    print("\nπŸ’‘ Tips:")
    print("   - Use realistic style for natural-looking completions")
    print("   - Use futuristic style for sci-fi transformations")
    print("   - Use artistic style for creative interpretations")

if __name__ == "__main__":
    run_demo()