Files
InterviewAI/setup.py
2026-05-22 15:16:01 +03:00

94 lines
2.5 KiB
Python

#!/usr/bin/env python3
"""
First-time setup script for Meeting Assistant
Downloads required AI models and sets up environment
"""
import os
import sys
import subprocess
import platform
def install_dependencies():
"""Install Python dependencies"""
print("📦 Installing Python dependencies...")
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
def download_models():
"""Download AI models"""
print("🤖 Downloading AI models...")
# Create models directory
os.makedirs("models", exist_ok=True)
# Download TinyLlama (small, fast, works on CPU)
model_urls = {
"tinyllama-1.1b.Q4_K_M.gguf": "https://huggingface.co/TheBloke/TinyLlama-1.1B-GGUF/resolve/main/tinyllama-1.1b.Q4_K_M.gguf"
}
import urllib.request
for model_name, url in model_urls.items():
model_path = os.path.join("models", model_name)
if not os.path.exists(model_path):
print(f"Downloading {model_name}...")
try:
urllib.request.urlretrieve(url, model_path)
print(f"✅ Downloaded {model_name}")
except Exception as e:
print(f"❌ Failed to download {model_name}: {e}")
print("⚠️ Will run in fallback mode without local LLM")
else:
print(f"{model_name} already exists")
def setup_audio():
"""Test audio setup"""
print("🎤 Testing audio input...")
try:
import sounddevice as sd
devices = sd.query_devices()
input_devices = [d for d in devices if d['max_input_channels'] > 0]
if input_devices:
print(f"✅ Found {len(input_devices)} audio input devices")
for device in input_devices:
print(f" - {device['name']}")
else:
print("⚠️ No audio input devices found")
except Exception as e:
print(f"⚠️ Audio setup error: {e}")
def main():
"""Run setup"""
print("🔧 Meeting Assistant - Setup")
print("=" * 50)
# Check Python version
if sys.version_info < (3, 8):
print("❌ Python 3.8 or higher required")
sys.exit(1)
# Platform info
print(f"💻 Platform: {platform.system()}")
# Install dependencies
install_dependencies()
# Download models
download_models()
# Setup audio
setup_audio()
print("\n✅ Setup complete!")
print("Run 'python main.py' to start the assistant")
if __name__ == "__main__":
main()