Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -110,34 +110,36 @@ class UNetWrapper:
|
|
110 |
|
111 |
# Create and upload model card
|
112 |
model_card = f"""---
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
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)
|