Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ def setup_environment():
|
|
| 23 |
model_path = "weights/CodeFormer/codeformer.pth"
|
| 24 |
download_file(model_url, model_path)
|
| 25 |
|
| 26 |
-
# Download
|
| 27 |
facelib_url = "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth"
|
| 28 |
facelib_path = "weights/facelib/detection_Resnet50_Final.pth"
|
| 29 |
download_file(facelib_url, facelib_path)
|
|
@@ -36,7 +36,7 @@ def setup_environment():
|
|
| 36 |
# Load CodeFormer model
|
| 37 |
def load_codeformer():
|
| 38 |
setup_environment()
|
| 39 |
-
model = CodeFormer(dim_embd=512, codebook_size=1024, n_head=8,
|
| 40 |
model.load_state_dict(torch.load("weights/CodeFormer/codeformer.pth", map_location='cpu'))
|
| 41 |
model.eval()
|
| 42 |
model = model.to('cpu') # Force CPU
|
|
|
|
| 23 |
model_path = "weights/CodeFormer/codeformer.pth"
|
| 24 |
download_file(model_url, model_path)
|
| 25 |
|
| 26 |
+
# Download facelib model (for face detection)
|
| 27 |
facelib_url = "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth"
|
| 28 |
facelib_path = "weights/facelib/detection_Resnet50_Final.pth"
|
| 29 |
download_file(facelib_url, facelib_path)
|
|
|
|
| 36 |
# Load CodeFormer model
|
| 37 |
def load_codeformer():
|
| 38 |
setup_environment()
|
| 39 |
+
model = CodeFormer(dim_embd=512, codebook_size=1024, n_head=8, n_layers=9, connect_list=['32', '64', '128', '256']) # Changed n_layer to n_layers
|
| 40 |
model.load_state_dict(torch.load("weights/CodeFormer/codeformer.pth", map_location='cpu'))
|
| 41 |
model.eval()
|
| 42 |
model = model.to('cpu') # Force CPU
|