To solve this problem, we first need to define the decision variables and the objective function. Let's denote the number of backpacks as $B$ and the number of handbags as $H$. The objective is to minimize the total cost, which can be represented as $5B + 8H$.

The constraints are:

1. The machine must be operated for at least 3000 minutes per week: $20B + 15H \geq 3000$
2. The factory must make a minimum of 180 items in total: $B + H \geq 180$
3. Non-negativity constraints: $B \geq 0, H \geq 0$

Now, let's translate these constraints and the objective function into Gurobi code.

```python
from gurobipy import *

# Create a model
m = Model("Backpack_Handbag_Optimization")

# Define decision variables
B = m.addVar(vtype=GRB.CONTINUOUS, name="Backpacks", lb=0)
H = m.addVar(vtype=GRB.CONTINUOUS, name="Handbags", lb=0)

# Define the objective function
m.setObjective(5*B + 8*H, GRB.MINIMIZE)

# Add constraints
m.addConstr(20*B + 15*H >= 3000, "Machine_Minutes")
m.addConstr(B + H >= 180, "Total_Items")

# Optimize the model
m.optimize()

# Print the results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Backpacks: {B.x}")
    print(f"Handbags: {H.x}")
    print(f"Total Cost: {m.objVal}")
else:
    print("No optimal solution found")
```