Rename README.md to README.md# Re-run the notebook creation after code state reset from nbformat import v4, write from pathlib import Path # Define notebook cells cells = [] # Title and Introduction cells.append(v4.new_markdown_cell("# RCC Beam Design Automation using Python\n\nThis notebook performs singly reinforced RCC beam design as per IS 456:2000 and also includes a sample prompt block for generating a reinforcement sketch using Stable Diffusion.")) # Input Parameters cells.append(v4.new_code_cell("""# Input Parameters L = 4.0 # Span in meters b = 230 # Width of beam in mm d = 450 # Effective depth in mm fck = 20 # Grade of concrete in MPa fy = 415 # Grade of steel in MPa wu = 25 # Factored load in kN/m phi = 16 # Bar diameter in mm """)) # Design Calculations cells.append(v4.new_code_cell("""import math # Step 1: Factored moment Mu = (wu * L**2) / 8 * 10**6 # in N-mm # Step 2: Limiting moment of resistance (for singly reinforced) Mu_lim = 0.138 * fck * b * d**2 # Step 3: Check if section is under-reinforced if Mu < Mu_lim: print("Section is under-reinforced. Proceeding with singly reinforced design.") else: print("Section exceeds limit. Use doubly reinforced beam.") # Step 4: Calculate Ast (Area of Steel) Ast = Mu / (0.87 * fy * (d - phi/2)) print(f"Required Ast = {Ast:.2f} mm²") # Step 5: Provide bars (suggest spacing) area_bar = (math.pi/4) * phi**2 n_bars = math.ceil(Ast / area_bar) spacing = (1000 * area_bar) / Ast print(f"Provide {n_bars} bars of {phi} mm diameter at spacing approx {spacing:.0f} mm c/c.") """)) # Summary Output cells.append(v4.new_code_cell("""from IPython.display import Markdown Markdown(f\"\"\" ### RCC Beam Design Summary - Span = {L} m - Width = {b} mm, Depth = {d} mm - Factored Load = {wu} kN/m - Mu = {Mu/1e6:.2f} kNm - Required Ast = {Ast:.2f} mm² - Bars: {n_bars} × {phi} mm at {spacing:.0f} mm c/c \"\"\") """)) # Stable Diffusion Prompt Block cells.append(v4.new_markdown_cell("## Stable Diffusion Prompt\nYou can use the following prompt in HuggingFace’s text-to-image tool or Replicate API to generate a conceptual sketch of the beam reinforcement.")) cells.append(v4.new_code_cell("""prompt = \"\"\"\nA detailed sketch of a reinforced concrete beam showing a rectangular cross-section, 4 tension bars at the bottom, stirrups with 8 mm diameter, and two hanger bars at the top. Include concrete texture and reinforcement labeling.\n\"\"\"\nprint(prompt)""")) # Save notebook nb = v4.new_notebook(cells=cells) notebook_path = Path("/mnt/data/RCC_Beam_AI_Design_Notebook.ipynb") with notebook_path.open("w", encoding="utf-8") as f: write(nb, f) str(notebook_path)
#6 opened 13 days ago
by
rehman80
Add generated example
#5 opened 18 days ago
by
clem

Getting an error trying to use it with DiffusionBee app offline
3
#4 opened 23 days ago
by
FerTech