Upload folder using huggingface_hub
Browse files- app.py +26 -1
- requirements.txt +2 -0
app.py
CHANGED
|
@@ -41,7 +41,19 @@ else:
|
|
| 41 |
|
| 42 |
# Configuration
|
| 43 |
VIDEO_SAMPLE_HZ = 1.0
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
# Global model cache
|
| 47 |
_vdpm_model = None
|
|
@@ -748,4 +760,17 @@ with gr.Blocks(title="DPM-Splat: 4D Gaussian Splatting", theme=gr.themes.Soft())
|
|
| 748 |
)
|
| 749 |
|
| 750 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 751 |
app.queue().launch(share=True, show_error=True)
|
|
|
|
| 41 |
|
| 42 |
# Configuration
|
| 43 |
VIDEO_SAMPLE_HZ = 1.0
|
| 44 |
+
|
| 45 |
+
# Set MAX_FRAMES based on VRAM
|
| 46 |
+
if device == "cuda":
|
| 47 |
+
if gpu_mem >= 20.0: # For A10G (24GB) or 3090/4090
|
| 48 |
+
MAX_FRAMES = 32
|
| 49 |
+
elif gpu_mem >= 12.0: # For T4 (16GB)
|
| 50 |
+
MAX_FRAMES = 16
|
| 51 |
+
else: # For 8GB or less
|
| 52 |
+
MAX_FRAMES = 8
|
| 53 |
+
else:
|
| 54 |
+
MAX_FRAMES = 4
|
| 55 |
+
|
| 56 |
+
print(f"✓ Configured limit: {MAX_FRAMES} frames based on {gpu_mem:.1f} GB VRAM")
|
| 57 |
|
| 58 |
# Global model cache
|
| 59 |
_vdpm_model = None
|
|
|
|
| 760 |
)
|
| 761 |
|
| 762 |
if __name__ == "__main__":
|
| 763 |
+
# Download model on startup
|
| 764 |
+
if device == "cuda":
|
| 765 |
+
print("Pre-loading VDPM model...")
|
| 766 |
+
try:
|
| 767 |
+
get_vdpm_model()
|
| 768 |
+
global _vdpm_model
|
| 769 |
+
_vdpm_model = None # Free VRAM but keep file cached
|
| 770 |
+
gc.collect()
|
| 771 |
+
torch.cuda.empty_cache()
|
| 772 |
+
print("✓ Model pre-loaded and cached")
|
| 773 |
+
except Exception as e:
|
| 774 |
+
print(f"⚠ Failed to pre-load model: {e}")
|
| 775 |
+
|
| 776 |
app.queue().launch(share=True, show_error=True)
|
requirements.txt
CHANGED
|
@@ -4,6 +4,8 @@ torch
|
|
| 4 |
torchvision
|
| 5 |
numpy==1.26.3
|
| 6 |
roma
|
|
|
|
|
|
|
| 7 |
gradio==5.17.1
|
| 8 |
pydantic==2.10.6
|
| 9 |
matplotlib
|
|
|
|
| 4 |
torchvision
|
| 5 |
numpy==1.26.3
|
| 6 |
roma
|
| 7 |
+
plyfile
|
| 8 |
+
imageio
|
| 9 |
gradio==5.17.1
|
| 10 |
pydantic==2.10.6
|
| 11 |
matplotlib
|