-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
67 lines (55 loc) · 1.94 KB
/
Copy pathsetup.py
File metadata and controls
67 lines (55 loc) · 1.94 KB
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
#!/usr/bin/env python3
"""
Setup script for SLM AI Assistant
"""
import subprocess
import sys
import os
def run_command(cmd):
"""Run a shell command and print output"""
print(f"Running: {cmd}")
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode != 0:
print(f"Error: {result.stderr}")
return result
def main():
print("=" * 60)
print("SLM AI Assistant Setup Script")
print("=" * 60)
# Check Python version
if sys.version_info < (3, 8):
print("❌ Python 3.8 or higher is required")
sys.exit(1)
print("✓ Python version OK")
# Install requirements
print("\n📦 Installing requirements...")
result = run_command(f"{sys.executable} -m pip install -r requirements.txt")
if result.returncode != 0:
print("❌ Failed to install requirements")
sys.exit(1)
print("✓ Requirements installed")
# Create directories
print("\n📁 Creating directories...")
os.makedirs("static", exist_ok=True)
os.makedirs("templates", exist_ok=True)
# Move HTML to templates if needed
if os.path.exists("index.html") and not os.path.exists("templates/index.html"):
import shutil
shutil.move("index.html", "templates/index.html")
print("✓ Directories created")
# Test model loading
print("\n🤖 Testing model loading...")
try:
import torch
print(f"✓ PyTorch version: {torch.__version__}")
print(f"✓ CUDA available: {torch.cuda.is_available()}")
except ImportError:
print("❌ PyTorch not installed properly")
print("\n✅ Setup complete!")
print("\nTo run the application:")
print("1. python app.py")
print("2. Open http://localhost:5000 in your browser")
print("\nOptional: Place a PDF file named 'docs.pdf' in the folder for RAG functionality")
print("=" * 60)
if __name__ == "__main__":
main()