Spaces:
Running on Zero
Running on Zero
File size: 2,415 Bytes
8c67742 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | """
Hyper-RVC Application Entry Point
Launches the Gradio WebUI for AI Voice Conversion
"""
import os
import sys
import subprocess
import logging
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
def check_dependencies():
"""Check if required packages are installed."""
required_packages = ['gradio', 'torch', 'librosa', 'soundfile']
missing = []
for pkg in required_packages:
try:
__import__(pkg)
except ImportError:
missing.append(pkg)
if missing:
logger.warning(f"Missing packages: {missing}. Attempting to install...")
for pkg in missing:
subprocess.check_call([sys.executable, "-m", "pip", "install", pkg])
logger.info("Dependencies installed successfully.")
def download_required_models():
"""Download required AI models for RVC processing."""
logger.info("Checking/downloading required models...")
try:
result = subprocess.run(
[sys.executable, "src/download_models.py"],
cwd=os.path.dirname(os.path.abspath(__file__)),
capture_output=True,
text=True,
timeout=300 # 5 minute timeout
)
if result.returncode != 0:
logger.error(f"Model download error: {result.stderr}")
else:
logger.info("Models ready.")
except subprocess.TimeoutExpired:
logger.warning("Model download timed out. Some features may not work.")
except Exception as e:
logger.error(f"Error during model setup: {e}")
def main():
"""Main entry point for Hyper-RVC application."""
print("="*60)
print(" Hyper-RVC - AI Voice Conversion System")
print("="*60)
print()
# Check and install dependencies
check_dependencies()
# Download required models
download_required_models()
# Parse command line arguments
args = " ".join(sys.argv[1:])
# Launch WebUI
cmd = f"python src/webui.py {args}"
print()
print("🚀 Starting Hyper-RVC WebUI...")
print(" The interface will be available at http://localhost:7860")
print()
print(" Press Ctrl+C to stop the server")
print("-"*60)
os.system(cmd)
if __name__ == "__main__":
main()
|