To solve this optimization problem, we first need to define the decision variables and the objective function. Let's denote the number of small teddy bears as \(S\) and the number of large teddy bears as \(L\).

The objective is to maximize profits. Given that a small teddy bear yields $50 in profit and a large one yields $8, our objective function can be written as:
\[ \text{Maximize:} \quad 50S + 8L \]

We have constraints based on the time available for filling and stitching:
1. For filling: \(5S + 10L \leq 700\), because each small teddy bear requires 5 minutes of filling, and each large one requires 10 minutes, with a total of 700 minutes available.
2. For stitching: \(25S + 35L \leq 900\), since each small teddy bear requires 25 minutes of stitching, and each large one requires 35 minutes, with a total of 900 minutes available.

Additionally, we have non-negativity constraints because the number of teddy bears cannot be negative:
\[ S \geq 0, L \geq 0 \]

Now, let's write this problem in Gurobi Python code:

```python
from gurobipy import *

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

# Decision variables
S = m.addVar(vtype=GRB.CONTINUOUS, name="SmallTeddyBears")
L = m.addVar(vtype=GRB.CONTINUOUS, name="LargeTeddyBears")

# Objective function: Maximize profits
m.setObjective(50*S + 8*L, GRB.MAXIMIZE)

# Constraints
m.addConstr(5*S + 10*L <= 700, "FillingTime")
m.addConstr(25*S + 35*L <= 900, "StitchingTime")

# Non-negativity constraints
m.addConstr(S >= 0, "NonNegativeSmall")
m.addConstr(L >= 0, "NonNegativeLarge")

# Optimize model
m.optimize()

# Print results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found.")
    print(f"Number of small teddy bears: {S.x}")
    print(f"Number of large teddy bears: {L.x}")
    print(f"Total profit: ${50*S.x + 8*L.x:.2f}")
else:
    print("No optimal solution found.")
```