-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.py
More file actions
55 lines (46 loc) · 1.69 KB
/
Copy pathdeploy.py
File metadata and controls
55 lines (46 loc) · 1.69 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
#!/usr/bin/env python3
"""
Deployment script for Tomas Chatbot
Now simplified: no NLTK downloads. Just checks for local nltk_data folder.
"""
import os
import sys
def check_nltk_data():
"""Verify that local nltk_data exists"""
nltk_data_dir = os.path.join(os.getcwd(), "nltk_data")
if os.path.exists(nltk_data_dir):
print(f"📂 Found local nltk_data at {nltk_data_dir}")
# Count packages inside for sanity check
count = sum([len(files) for _, _, files in os.walk(nltk_data_dir)])
print(f"✅ nltk_data is present with ~{count} files")
return True
else:
print("❌ No nltk_data folder found! Please add it to the repo.")
return False
def install_requirements():
"""Install Python requirements"""
print("📦 Installing Python requirements...")
try:
import subprocess
result = subprocess.run([
sys.executable, "-m", "pip", "install", "-r", "requirements.txt"
], capture_output=True, text=True, timeout=300)
if result.returncode == 0:
print("✅ Requirements installed successfully")
return True
else:
print(f"❌ Requirements installation failed: {result.stderr}")
return False
except Exception as e:
print(f"❌ Requirements installation error: {e}")
return False
def main():
print("🚀 Starting Tomas Chatbot Build Process...")
# Install requirements
install_requirements()
# Check nltk_data
check_nltk_data()
print("✅ Build process completed successfully!")
print("🌐 Ready for deployment - use 'uvicorn app:app --host 0.0.0.0 --port $PORT'")
if __name__ == "__main__":
main()