Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| # Function to generate a construction checklist | |
| def generate_checklist(project_type, size): | |
| try: | |
| size = float(size) # Ensure size is a valid number | |
| except ValueError: | |
| return "Error: Size must be a valid number (e.g., 1200)." | |
| checklist = [] | |
| # Base checklist items for all projects | |
| checklist.append("1. Conduct site inspection.") | |
| checklist.append("2. Obtain necessary permits.") | |
| checklist.append("3. Create a design plan and layout.") | |
| # Add project-specific tasks | |
| if project_type.lower() == "house": | |
| checklist.append("4. Excavate and lay foundation.") | |
| checklist.append("5. Construct walls and roofing.") | |
| checklist.append("6. Install plumbing and electrical systems.") | |
| checklist.append("7. Finish interiors (flooring, painting, fixtures).") | |
| elif project_type.lower() == "office": | |
| checklist.append("4. Prepare open floor plan.") | |
| checklist.append("5. Install HVAC and networking systems.") | |
| checklist.append("6. Divide spaces for offices and meeting rooms.") | |
| checklist.append("7. Add office furniture and equipment.") | |
| elif project_type.lower() == "garden shed": | |
| checklist.append("4. Level the ground and lay the base.") | |
| checklist.append("5. Construct the shed frame and walls.") | |
| checklist.append("6. Add roofing and weatherproofing.") | |
| checklist.append("7. Install shelves and storage options.") | |
| else: | |
| return "Error: Unknown project type. Please choose House, Office, or Garden Shed." | |
| # Add size-specific suggestions | |
| if size < 500: | |
| checklist.append("8. Use compact equipment for small spaces.") | |
| elif size > 2000: | |
| checklist.append("8. Ensure heavy equipment access for large areas.") | |
| checklist.append("9. Conduct final inspection and approval.") | |
| return "\n".join(checklist) | |
| # Gradio interface | |
| def construction_checklist_generator(project_type, size): | |
| checklist = generate_checklist(project_type, size) | |
| return checklist | |
| interface = gr.Interface( | |
| fn=construction_checklist_generator, | |
| inputs=[ | |
| gr.Textbox(label="Project Type (e.g., House, Office, Garden Shed)"), | |
| gr.Textbox(label="Project Size (in square feet, e.g., 1200)"), | |
| ], | |
| outputs=[ | |
| gr.Textbox(label="Construction Checklist"), | |
| ], | |
| title="Construction Checklist Generator", | |
| description="Provide the project type and size to generate a detailed construction checklist." | |
| ) | |
| if __name__ == "__main__": | |
| interface.launch() | |