Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
"""
|
| 2 |
InfiniteTalk - Talking Video Generator
|
| 3 |
-
Gradio Space
|
| 4 |
"""
|
| 5 |
|
| 6 |
import os
|
| 7 |
import sys
|
| 8 |
|
| 9 |
# CRITICAL: Set environment variables BEFORE any torch/torchvision imports
|
| 10 |
-
# This prevents torchvision from registering CUDA ops that don't exist
|
| 11 |
os.environ["TORCHVISION_DISABLE_META_REGISTRATIONS"] = "1"
|
| 12 |
os.environ["TORCH_LOGS"] = "-all" # Reduce torch logging noise
|
| 13 |
|
|
@@ -19,7 +19,6 @@ from pathlib import Path
|
|
| 19 |
import gradio as gr
|
| 20 |
import torch
|
| 21 |
import numpy as np
|
| 22 |
-
import spaces
|
| 23 |
|
| 24 |
# Suppress warnings
|
| 25 |
warnings.filterwarnings('ignore')
|
|
@@ -147,7 +146,6 @@ def validate_inputs(image_or_video, audio, resolution, steps):
|
|
| 147 |
raise gr.Error(" | ".join(errors))
|
| 148 |
|
| 149 |
|
| 150 |
-
@spaces.GPU(duration=180)
|
| 151 |
def generate_video(
|
| 152 |
image_or_video,
|
| 153 |
audio_file,
|
|
@@ -173,6 +171,13 @@ def generate_video(
|
|
| 173 |
Path to generated video
|
| 174 |
"""
|
| 175 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
# Initialize models if needed
|
| 177 |
if not models_loaded:
|
| 178 |
initialize_models(progress)
|
|
@@ -454,7 +459,7 @@ def create_interface():
|
|
| 454 |
### About
|
| 455 |
Powered by [InfiniteTalk](https://github.com/MeiGen-AI/InfiniteTalk) - Apache 2.0 License
|
| 456 |
|
| 457 |
-
**
|
| 458 |
|
| 459 |
💡 **Tips**:
|
| 460 |
- First generation downloads models (~15GB) and may take 2-3 minutes
|
|
|
|
| 1 |
"""
|
| 2 |
InfiniteTalk - Talking Video Generator
|
| 3 |
+
Gradio Space for HuggingFace
|
| 4 |
"""
|
| 5 |
|
| 6 |
import os
|
| 7 |
import sys
|
| 8 |
|
| 9 |
# CRITICAL: Set environment variables BEFORE any torch/torchvision imports
|
| 10 |
+
# This prevents torchvision from registering CUDA ops that don't exist at import time
|
| 11 |
os.environ["TORCHVISION_DISABLE_META_REGISTRATIONS"] = "1"
|
| 12 |
os.environ["TORCH_LOGS"] = "-all" # Reduce torch logging noise
|
| 13 |
|
|
|
|
| 19 |
import gradio as gr
|
| 20 |
import torch
|
| 21 |
import numpy as np
|
|
|
|
| 22 |
|
| 23 |
# Suppress warnings
|
| 24 |
warnings.filterwarnings('ignore')
|
|
|
|
| 146 |
raise gr.Error(" | ".join(errors))
|
| 147 |
|
| 148 |
|
|
|
|
| 149 |
def generate_video(
|
| 150 |
image_or_video,
|
| 151 |
audio_file,
|
|
|
|
| 171 |
Path to generated video
|
| 172 |
"""
|
| 173 |
try:
|
| 174 |
+
# Check if GPU is available
|
| 175 |
+
if not torch.cuda.is_available():
|
| 176 |
+
raise gr.Error(
|
| 177 |
+
"⚠️ GPU not available. This Space requires GPU hardware to generate videos. "
|
| 178 |
+
"Please apply for a Community GPU Grant in the Space settings, or run this app locally with a GPU."
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
# Initialize models if needed
|
| 182 |
if not models_loaded:
|
| 183 |
initialize_models(progress)
|
|
|
|
| 459 |
### About
|
| 460 |
Powered by [InfiniteTalk](https://github.com/MeiGen-AI/InfiniteTalk) - Apache 2.0 License
|
| 461 |
|
| 462 |
+
⚠️ **Note**: This Space requires GPU hardware to generate videos. Apply for a Community GPU Grant in Settings.
|
| 463 |
|
| 464 |
💡 **Tips**:
|
| 465 |
- First generation downloads models (~15GB) and may take 2-3 minutes
|