YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

import streamlit as st import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Patch import io

st.set_page_config(page_title="🚛 TIR Yerleştirme", layout="wide") st.title("🚛 TIR Yerleştirme ve 3D Görselleştirme")

Sidebar - TIR Boyutları

st.sidebar.header("🚛 TIR / Konteyner Boyutları") truck_length = st.sidebar.number_input("Uzunluk (mm)", min_value=1000, value=13600) truck_width = st.sidebar.number_input("Genişlik (mm)", min_value=1000, value=2450) truck_height = st.sidebar.number_input("Yükseklik (mm)", min_value=1000, value=2700) max_weight = st.sidebar.number_input("Maks. Ağırlık (kg)", min_value=1000, value=24000)

uploaded_file = st.file_uploader("Excel Dosyasını Yükleyin", type=["xlsx"])

if uploaded_file is None: st.info("Lütfen bir Excel dosyası yükleyin.") st.stop()

try: df = pd.read_excel(uploaded_file, header=5) except Exception as e: st.error(f"Excel okunamadı: {e}") st.stop()

try: gensets = df.iloc[:, [0, 5, 8, 10, 12, 14]].copy() gensets.columns = ['Model', 'Sase', 'Length', 'Width', 'Height', 'Weight'] except: st.error("Excel formatı beklenenden farklı!") st.stop()

gensets['Weight'] = pd.to_numeric(gensets['Weight'], errors='coerce') gensets = gensets.dropna(subset=['Weight'])

for col in ['Length', 'Width', 'Height']: gensets[col] = pd.to_numeric( gensets[col].astype(str).str.replace('*', '', regex=False).str.replace(',', '.', regex=False), errors='coerce' )

gensets = gensets.dropna(subset=['Length', 'Width', 'Height']).reset_index(drop=True)

st.success(f"{len(gensets)} adet jeneratör yüklendi ✔")

Yerleştirme Algoritması

def pack_boxes(truck_l, truck_w, truck_h, max_weight, df): placed = [] x_offset = 0 current_weight = 0 colors = plt.cm.tab20(np.linspace(0, 1, len(df))) df['Volume'] = df['Length'] * df['Width'] * df['Height'] df = df.sort_values('Volume', ascending=False).reset_index(drop=True)

for i, row in df.iterrows():
    dims = [(row['Length'], row['Width']), (row['Width'], row['Length'])]
    for L, W in dims:
        if (current_weight + row['Weight'] <= max_weight and
            x_offset + L <= truck_l and
            W <= truck_w and
            row['Height'] <= truck_h):

            placed.append({
                "model": row['Model'],
                "x": x_offset,
                "y": 0,
                "z": 0,
                "dx": L,
                "dy": W,
                "dz": row['Height'],
                "weight": row['Weight'],
                "color": colors[i],
                "orientation": "Rotated" if L != row['Length'] else "Normal"
            })
            x_offset += L
            current_weight += row['Weight']
            break

return placed, current_weight, x_offset

placed_boxes, total_weight, used_length = pack_boxes( truck_length, truck_width, truck_height, max_weight, gensets )

Raporlar

st.header("📊 Yerleştirme Sonucu") col1, col2, col3 = st.columns(3) col1.metric("Adet", len(placed_boxes)) col2.metric("Ağırlık", f"{total_weight:,.0f} kg") col3.metric("Kullanım", f"%{used_length/truck_length*100:.1f}")

3D Grafik

fig = plt.figure(figsize=(10, 5)) ax = fig.add_subplot(111, projection="3d")

for b in placed_boxes: ax.bar3d(b['x'], b['y'], b['z'], b['dx'], b['dy'], b['dz'], color=b['color'], edgecolor="k")

ax.set_xlabel("Uzunluk (mm)") ax.set_ylabel("Genişlik (mm)") ax.set_zlabel("Yükseklik (mm)") st.pyplot(fig)

Detay Tablosu

result_df = pd.DataFrame([{ "Sıra": i + 1, "Model": b['model'], "Ölçüler (mm)": f"{b['dx']} x {b['dy']} x {b['dz']}", "Ağırlık": b['weight'], "Yön": b["orientation"] } for i, b in enumerate(placed_boxes)])

st.dataframe(result_df)

Excel indirme

output = io.BytesIO() result_df.to_excel(output, index=False) output.seek(0) st.download_button("📥 Excel İndir", output, "rapor.xlsx")

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support