Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,7 +29,7 @@ def generate_data(noise=0):
|
|
| 29 |
|
| 30 |
# Train the model
|
| 31 |
def train_model(epochs, learning_rate):
|
| 32 |
-
print(f"π Training started with {epochs} epochs and learning rate {learning_rate}...")
|
| 33 |
|
| 34 |
model = SimpleNN(1, 4, 1)
|
| 35 |
optimizer = optim.SGD(model.parameters(), lr=learning_rate)
|
|
@@ -48,7 +48,7 @@ def train_model(epochs, learning_rate):
|
|
| 48 |
optimizer.step()
|
| 49 |
losses.append(loss.item())
|
| 50 |
|
| 51 |
-
print("β
Training complete. Plotting loss...")
|
| 52 |
|
| 53 |
# Plot loss graph
|
| 54 |
plt.figure(figsize=(5, 3))
|
|
@@ -77,8 +77,9 @@ iface = gr.Interface(
|
|
| 77 |
description="Train a simple neural network and visualize the loss curve.",
|
| 78 |
)
|
| 79 |
|
| 80 |
-
print("β
Gradio is about to launch...")
|
| 81 |
iface.launch()
|
| 82 |
|
| 83 |
|
| 84 |
|
|
|
|
|
|
| 29 |
|
| 30 |
# Train the model
|
| 31 |
def train_model(epochs, learning_rate):
|
| 32 |
+
print(f"π Training started with {epochs} epochs and learning rate {learning_rate}...")
|
| 33 |
|
| 34 |
model = SimpleNN(1, 4, 1)
|
| 35 |
optimizer = optim.SGD(model.parameters(), lr=learning_rate)
|
|
|
|
| 48 |
optimizer.step()
|
| 49 |
losses.append(loss.item())
|
| 50 |
|
| 51 |
+
print("β
Training complete. Plotting loss...")
|
| 52 |
|
| 53 |
# Plot loss graph
|
| 54 |
plt.figure(figsize=(5, 3))
|
|
|
|
| 77 |
description="Train a simple neural network and visualize the loss curve.",
|
| 78 |
)
|
| 79 |
|
| 80 |
+
print("β
Gradio is about to launch...")
|
| 81 |
iface.launch()
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
+
|