K00B404 commited on
Commit
3a1c257
·
verified ·
1 Parent(s): b612bcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -28
app.py CHANGED
@@ -110,34 +110,36 @@ class UNetWrapper:
110
 
111
  # Create and upload model card
112
  model_card = f"""---
113
- tags:
114
- - unet
115
- - pix2pix
116
- library_name: pytorch
117
- ---
118
-
119
- # Pix2Pix UNet Model
120
-
121
- ## Model Description
122
- Custom UNet model for Pix2Pix image translation.
123
- - Image Size: {1024 if isinstance(self.model, big_UNet) else 256}
124
- - Model Type: {"Big (1024)" if isinstance(self.model, big_UNet) else "Small (256)"}
125
-
126
- ## Usage
127
-
128
- ```python
129
- import torch
130
- from small_256_model import UNet as small_UNet
131
- from big_1024_model import UNet as big_UNet
132
-
133
- # Load the model
134
- checkpoint = torch.load('model_weights.pth')
135
- model = big_UNet() if checkpoint['model_config']['big'] else small_UNet()
136
- model.load_state_dict(checkpoint['model_state_dict'])
137
- model.eval()
138
- Model Architecture
139
- {str(self.model)}
140
- """
 
 
141
  # Save and upload README
142
  with open("README.md", "w") as f:
143
  f.write(model_card)
 
110
 
111
  # Create and upload model card
112
  model_card = f"""---
113
+ tags:
114
+ - unet
115
+ - pix2pix
116
+ - pytorch
117
+ library_name: pytorch
118
+ ---
119
+
120
+ # Pix2Pix UNet Model
121
+
122
+ ## Model Description
123
+ Custom UNet model for Pix2Pix image translation.
124
+ - **Image Size:** {1024 if isinstance(self.model, big_UNet) else 256}
125
+ - **Model Type:** {"Big (1024)" if isinstance(self.model, big_UNet) else "Small (256)"}
126
+
127
+ ## Usage
128
+
129
+ ```python
130
+ import torch
131
+ from small_256_model import UNet as small_UNet
132
+ from big_1024_model import UNet as big_UNet
133
+
134
+ # Load the model
135
+ checkpoint = torch.load('model_weights.pth')
136
+ model = big_UNet() if checkpoint['model_config']['big'] else small_UNet()
137
+ model.load_state_dict(checkpoint['model_state_dict'])
138
+ model.eval()
139
+
140
+ Model Architecture
141
+
142
+ {str(self.model)} """
143
  # Save and upload README
144
  with open("README.md", "w") as f:
145
  f.write(model_card)