-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_setup.py
More file actions
executable file
·120 lines (100 loc) · 3.27 KB
/
Copy pathtest_setup.py
File metadata and controls
executable file
·120 lines (100 loc) · 3.27 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env python3
"""
Test script to verify the Speech Summarizer API setup
Run this to check if everything is configured correctly
"""
import sys
import os
def check_python_version():
"""Check if Python version is compatible"""
version = sys.version_info
print(f"✓ Python version: {version.major}.{version.minor}.{version.micro}")
if version.major == 3 and version.minor >= 8:
print(" ✓ Python version is compatible (3.8+)")
return True
else:
print(f" ✗ Python version {version.major}.{version.minor} is too old. Need 3.8+")
return False
def check_file_structure():
"""Check if all required files exist"""
required_files = [
'app.py',
'summarizer.py',
'requirements.txt',
'README.md',
'render.yaml',
'Dockerfile',
'Procfile',
'runtime.txt',
'.env.example',
'.gitignore',
'templates/index.html',
'static/style.css',
'static/script.js'
]
print("\nChecking file structure...")
all_exist = True
for file in required_files:
if os.path.exists(file):
print(f" ✓ {file}")
else:
print(f" ✗ {file} - MISSING")
all_exist = False
return all_exist
def check_dependencies():
"""Check which dependencies are installed"""
dependencies = [
('flask', 'Flask'),
('flask_cors', 'Flask-CORS'),
('sentence_transformers', 'Sentence-Transformers'),
('nltk', 'NLTK'),
('sklearn', 'scikit-learn'),
('numpy', 'NumPy'),
]
print("\nChecking dependencies...")
missing = []
for module_name, display_name in dependencies:
try:
__import__(module_name)
print(f" ✓ {display_name}")
except ImportError:
print(f" ✗ {display_name} - NOT INSTALLED")
missing.append(display_name)
return len(missing) == 0, missing
def main():
print("=" * 60)
print("Speech Summarizer API - Setup Verification")
print("=" * 60)
# Check Python version
python_ok = check_python_version()
# Check file structure
files_ok = check_file_structure()
# Check dependencies
deps_ok, missing_deps = check_dependencies()
# Summary
print("\n" + "=" * 60)
print("SUMMARY")
print("=" * 60)
if python_ok and files_ok:
print("✓ Python version: OK")
print("✓ File structure: OK")
else:
if not python_ok:
print("✗ Python version: FAILED")
if not files_ok:
print("✗ File structure: MISSING FILES")
if deps_ok:
print("✓ Dependencies: ALL INSTALLED")
print("\n🎉 Setup is complete! You can run the API with:")
print(" python app.py")
else:
print(f"✗ Dependencies: {len(missing_deps)} MISSING")
print("\n📦 To install dependencies, run:")
print(" python -m venv venv")
print(" source venv/bin/activate # On Windows: venv\\Scripts\\activate")
print(" pip install -r requirements.txt")
print(" python -c \"import nltk; nltk.download('punkt'); nltk.download('punkt_tab')\"")
print("\n📚 For more information, see README.md")
print("=" * 60)
if __name__ == "__main__":
main()