GopalGoyal commited on
Commit
e9ffad6
·
verified ·
1 Parent(s): 9b5b682

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -4,6 +4,17 @@ from fastapi import FastAPI, File, UploadFile
4
  from fastapi.responses import FileResponse
5
  import subprocess
6
  import uuid
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  app = FastAPI(title="Wav2Lip API (HuggingFace)")
9
 
 
4
  from fastapi.responses import FileResponse
5
  import subprocess
6
  import uuid
7
+ import os
8
+
9
+ def validate_checkpoint(path):
10
+ if not os.path.exists(path):
11
+ raise Exception(f"Checkpoint missing: {path}")
12
+ if os.path.getsize(path) < 100 * 1024 * 1024: # <100MB = corrupted
13
+ raise Exception(f"Checkpoint corrupted or incomplete: {path}")
14
+
15
+ # Validate
16
+ validate_checkpoint("Wav2Lip/Wav2Lip.pth")
17
+ validate_checkpoint("Wav2Lip/wav2lip_gan.pth")
18
 
19
  app = FastAPI(title="Wav2Lip API (HuggingFace)")
20