Spaces:
Build error
Build error
SefyanKehail
commited on
Commit
·
d5de549
1
Parent(s):
17b871f
epochs test
Browse files
app.py
CHANGED
|
@@ -5,6 +5,10 @@ import torch.nn as nn
|
|
| 5 |
import torch.optim as optim
|
| 6 |
from torchvision import datasets, transforms
|
| 7 |
from torch.utils.data import DataLoader
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
class SimpleNet(nn.Module):
|
| 10 |
def __init__(self):
|
|
@@ -45,6 +49,10 @@ def train_model(epochs):
|
|
| 45 |
|
| 46 |
# Save the model checkpoint
|
| 47 |
torch.save(model.state_dict(), "simple_net.pth")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
return "Training completed and model saved."
|
| 49 |
|
| 50 |
# Define the Gradio interface
|
|
|
|
| 5 |
import torch.optim as optim
|
| 6 |
from torchvision import datasets, transforms
|
| 7 |
from torch.utils.data import DataLoader
|
| 8 |
+
from huggingface_hub import notebook_login
|
| 9 |
+
from huggingface_hub import Repository
|
| 10 |
+
|
| 11 |
+
notebook_login()
|
| 12 |
|
| 13 |
class SimpleNet(nn.Module):
|
| 14 |
def __init__(self):
|
|
|
|
| 49 |
|
| 50 |
# Save the model checkpoint
|
| 51 |
torch.save(model.state_dict(), "simple_net.pth")
|
| 52 |
+
repo = Repository(local_dir=" https://huggingface.co/spaces/Transduce/vc_demo_clean", repo_id="Transduce/testing_cuda", use_auth_token=True)
|
| 53 |
+
repo.git_add(file_paths="simple_net.pth")
|
| 54 |
+
repo.git_commit("model checkpoint")
|
| 55 |
+
repo.git_push()
|
| 56 |
return "Training completed and model saved."
|
| 57 |
|
| 58 |
# Define the Gradio interface
|