Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# Function to generate a construction checklist
|
| 4 |
+
def generate_checklist(project_type, size):
|
| 5 |
+
try:
|
| 6 |
+
size = float(size) # Ensure size is a valid number
|
| 7 |
+
except ValueError:
|
| 8 |
+
return "Error: Size must be a valid number (e.g., 1200)."
|
| 9 |
+
|
| 10 |
+
checklist = []
|
| 11 |
+
|
| 12 |
+
# Base checklist items for all projects
|
| 13 |
+
checklist.append("1. Conduct site inspection.")
|
| 14 |
+
checklist.append("2. Obtain necessary permits.")
|
| 15 |
+
checklist.append("3. Create a design plan and layout.")
|
| 16 |
+
|
| 17 |
+
# Add project-specific tasks
|
| 18 |
+
if project_type.lower() == "house":
|
| 19 |
+
checklist.append("4. Excavate and lay foundation.")
|
| 20 |
+
checklist.append("5. Construct walls and roofing.")
|
| 21 |
+
checklist.append("6. Install plumbing and electrical systems.")
|
| 22 |
+
checklist.append("7. Finish interiors (flooring, painting, fixtures).")
|
| 23 |
+
elif project_type.lower() == "office":
|
| 24 |
+
checklist.append("4. Prepare open floor plan.")
|
| 25 |
+
checklist.append("5. Install HVAC and networking systems.")
|
| 26 |
+
checklist.append("6. Divide spaces for offices and meeting rooms.")
|
| 27 |
+
checklist.append("7. Add office furniture and equipment.")
|
| 28 |
+
elif project_type.lower() == "garden shed":
|
| 29 |
+
checklist.append("4. Level the ground and lay the base.")
|
| 30 |
+
checklist.append("5. Construct the shed frame and walls.")
|
| 31 |
+
checklist.append("6. Add roofing and weatherproofing.")
|
| 32 |
+
checklist.append("7. Install shelves and storage options.")
|
| 33 |
+
else:
|
| 34 |
+
return "Error: Unknown project type. Please choose House, Office, or Garden Shed."
|
| 35 |
+
|
| 36 |
+
# Add size-specific suggestions
|
| 37 |
+
if size < 500:
|
| 38 |
+
checklist.append("8. Use compact equipment for small spaces.")
|
| 39 |
+
elif size > 2000:
|
| 40 |
+
checklist.append("8. Ensure heavy equipment access for large areas.")
|
| 41 |
+
|
| 42 |
+
checklist.append("9. Conduct final inspection and approval.")
|
| 43 |
+
|
| 44 |
+
return "\n".join(checklist)
|
| 45 |
+
|
| 46 |
+
# Gradio interface
|
| 47 |
+
def construction_checklist_generator(project_type, size):
|
| 48 |
+
checklist = generate_checklist(project_type, size)
|
| 49 |
+
return checklist
|
| 50 |
+
|
| 51 |
+
interface = gr.Interface(
|
| 52 |
+
fn=construction_checklist_generator,
|
| 53 |
+
inputs=[
|
| 54 |
+
gr.Textbox(label="Project Type (e.g., House, Office, Garden Shed)"),
|
| 55 |
+
gr.Textbox(label="Project Size (in square feet, e.g., 1200)"),
|
| 56 |
+
],
|
| 57 |
+
outputs=[
|
| 58 |
+
gr.Textbox(label="Construction Checklist"),
|
| 59 |
+
],
|
| 60 |
+
title="Construction Checklist Generator",
|
| 61 |
+
description="Provide the project type and size to generate a detailed construction checklist."
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
if __name__ == "__main__":
|
| 65 |
+
interface.launch()
|