hackerbhai commited on
Commit
e26f72b
·
verified ·
1 Parent(s): 2f01622

Delete demo.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. demo.py +0 -270
demo.py DELETED
@@ -1,270 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Ekalavya - Lightweight Demo
4
- Tests code structure without loading full models (for low-memory environments)
5
- """
6
-
7
- import sys
8
- from pathlib import Path
9
-
10
- print("="*70)
11
- print("🎯 EKALAVYA MYTHOS - LIGHTWEIGHT DEMO")
12
- print("="*70)
13
-
14
- # Add project to path
15
- sys.path.insert(0, str(Path(__file__).parent))
16
-
17
- def test_imports():
18
- """Test all imports work"""
19
- print("\n📦 Testing imports...")
20
-
21
- try:
22
- from model import create_model, ALL_LANGUAGES, INDIAN_LANGUAGES, CONFIGS
23
- from model.multimodal import EkalavyaMultiModal, process_image, process_audio, process_video
24
- from model.tokenizer import IndianLanguageTokenizer
25
- from model.deep_reasoning import DeepReasoningEngine, ChainOfThoughtGenerator
26
- print("✅ All imports successful")
27
- return True
28
- except Exception as e:
29
- print(f"❌ Import failed: {e}")
30
- return False
31
-
32
- def test_configs():
33
- """Test model configurations"""
34
- print("\n⚙️ Testing model configurations...")
35
-
36
- try:
37
- from model import CONFIGS
38
-
39
- print(f"✅ Available configurations: {len(CONFIGS)}")
40
-
41
- for name, config in CONFIGS.items():
42
- dim = config['dim']
43
- layers = config['n_layers']
44
- max_seq = config.get('max_seq_len', 16384)
45
-
46
- print(f"\n {name.upper()}:")
47
- print(f" - Dim: {dim:,}")
48
- print(f" - Layers: {layers}")
49
- print(f" - Max Sequence: {max_seq:,} tokens")
50
-
51
- return True
52
- except Exception as e:
53
- print(f"❌ Config test failed: {e}")
54
- return False
55
-
56
- def test_languages():
57
- """Test language support"""
58
- print("\n🌍 Testing language support...")
59
-
60
- try:
61
- from model import ALL_LANGUAGES, INDIAN_LANGUAGES
62
-
63
- print(f"✅ Total languages: {len(ALL_LANGUAGES)}")
64
- print(f"✅ Indian languages: {len(INDIAN_LANGUAGES)}")
65
-
66
- # Show some languages
67
- print("\n📋 Sample languages:")
68
- for lang in INDIAN_LANGUAGES[:5]:
69
- print(f" - {lang}")
70
- print(" - ... and more")
71
-
72
- return True
73
- except Exception as e:
74
- print(f"❌ Language test failed: {e}")
75
- return False
76
-
77
- def test_tokenizer_structure():
78
- """Test tokenizer structure"""
79
- print("\n🔤 Testing tokenizer structure...")
80
-
81
- try:
82
- from model.tokenizer import IndianLanguageTokenizer
83
-
84
- # Check class exists and has required methods
85
- assert hasattr(IndianLanguageTokenizer, '__init__')
86
- assert hasattr(IndianLanguageTokenizer, 'encode')
87
- assert hasattr(IndianLanguageTokenizer, 'decode')
88
-
89
- print("✅ Tokenizer structure valid")
90
- print(" - Has __init__ method")
91
- print(" - Has encode method")
92
- print(" - Has decode method")
93
-
94
- return True
95
- except Exception as e:
96
- print(f"❌ Tokenizer test failed: {e}")
97
- return False
98
-
99
- def test_multimodal_structure():
100
- """Test multi-modal model structure"""
101
- print("\n🖼️ Testing multi-modal structure...")
102
-
103
- try:
104
- from model.multimodal import EkalavyaMultiModal, VisionEncoder, AudioEncoder
105
-
106
- # Check classes exist
107
- assert EkalavyaMultiModal is not None
108
- assert VisionEncoder is not None
109
- assert AudioEncoder is not None
110
-
111
- print("✅ Multi-modal structure valid")
112
- print(" - EkalavyaMultiModal class exists")
113
- print(" - VisionEncoder class exists")
114
- print(" - AudioEncoder class exists")
115
-
116
- return True
117
- except Exception as e:
118
- print(f"❌ Multi-modal test failed: {e}")
119
- return False
120
-
121
- def test_deep_reasoning_structure():
122
- """Test deep reasoning structure"""
123
- print("\n🧠 Testing deep reasoning structure...")
124
-
125
- try:
126
- from model.deep_reasoning import DeepReasoningEngine, ChainOfThoughtGenerator
127
-
128
- # Check classes exist
129
- assert DeepReasoningEngine is not None
130
- assert ChainOfThoughtGenerator is not None
131
-
132
- # Check methods exist
133
- assert hasattr(DeepReasoningEngine, 'analyze_deeply')
134
- assert hasattr(ChainOfThoughtGenerator, 'generate_cot')
135
-
136
- print("✅ Deep reasoning structure valid")
137
- print(" - DeepReasoningEngine class exists")
138
- print(" - ChainOfThoughtGenerator class exists")
139
- print(" - Has analyze_deeply method")
140
- print(" - Has generate_cot method")
141
-
142
- return True
143
- except Exception as e:
144
- print(f"❌ Deep reasoning test failed: {e}")
145
- return False
146
-
147
- def test_api_structure():
148
- """Test API structure"""
149
- print("\n🌐 Testing API structure...")
150
-
151
- try:
152
- # Check api.py exists
153
- api_path = Path(__file__).parent / "api.py"
154
- assert api_path.exists(), "api.py not found"
155
-
156
- # Read and check for key endpoints
157
- with open(api_path, 'r') as f:
158
- content = f.read()
159
-
160
- endpoints = [
161
- '/generate',
162
- '/analyze/image',
163
- '/analyze/video',
164
- '/analyze/audio',
165
- '/upload/image',
166
- '/health',
167
- '/info'
168
- ]
169
-
170
- found = []
171
- for endpoint in endpoints:
172
- if endpoint in content:
173
- found.append(endpoint)
174
-
175
- print(f"✅ API structure valid")
176
- print(f" - Found {len(found)}/{len(endpoints)} endpoints")
177
- for ep in found:
178
- print(f" - {ep}")
179
-
180
- return len(found) == len(endpoints)
181
- except Exception as e:
182
- print(f"❌ API test failed: {e}")
183
- return False
184
-
185
- def test_documentation():
186
- """Test documentation exists"""
187
- print("\n📚 Testing documentation...")
188
-
189
- try:
190
- docs = [
191
- 'README.md',
192
- 'MULTIMODAL_GUIDE.md',
193
- 'SERVER_REQUIREMENTS.md',
194
- 'WORKING_FEATURES.md',
195
- 'ALL_AI_COMPARISON.md'
196
- ]
197
-
198
- found = []
199
- for doc in docs:
200
- doc_path = Path(__file__).parent / doc
201
- if doc_path.exists():
202
- found.append(doc)
203
-
204
- print(f"✅ Documentation valid")
205
- print(f" - Found {len(found)}/{len(docs)} documents")
206
- for doc in found:
207
- print(f" - {doc}")
208
-
209
- return len(found) >= 3 # At least 3 docs should exist
210
- except Exception as e:
211
- print(f"❌ Documentation test failed: {e}")
212
- return False
213
-
214
- def main():
215
- """Run all tests"""
216
- print("\n🚀 Starting lightweight tests...\n")
217
- print("⚠️ Note: This demo tests code structure without loading full models")
218
- print(" (for low-memory environments)")
219
-
220
- tests = [
221
- ("Imports", test_imports),
222
- ("Configurations", test_configs),
223
- ("Languages", test_languages),
224
- ("Tokenizer Structure", test_tokenizer_structure),
225
- ("Multi-Modal Structure", test_multimodal_structure),
226
- ("Deep Reasoning Structure", test_deep_reasoning_structure),
227
- ("API Structure", test_api_structure),
228
- ("Documentation", test_documentation),
229
- ]
230
-
231
- results = []
232
- for name, test_func in tests:
233
- try:
234
- result = test_func()
235
- results.append((name, result))
236
- except Exception as e:
237
- print(f"❌ {name} test crashed: {e}")
238
- results.append((name, False))
239
-
240
- # Summary
241
- print("\n" + "="*70)
242
- print("📊 TEST SUMMARY")
243
- print("="*70)
244
-
245
- passed = sum(1 for _, r in results if r)
246
- total = len(results)
247
-
248
- for name, result in results:
249
- status = "✅ PASS" if result else "❌ FAIL"
250
- print(f"{status} - {name}")
251
-
252
- print("\n" + "="*70)
253
- print(f"🎯 RESULTS: {passed}/{total} tests passed")
254
- print("="*70)
255
-
256
- if passed == total:
257
- print("\n🎉 ALL TESTS PASSED! Ekalavya is fully functional!")
258
- print("\n💡 Note: Full model testing requires 16GB+ RAM")
259
- print(" See SERVER_REQUIREMENTS.md for hardware specs")
260
- print("\n🚀 Ready to deploy:")
261
- print(" 1. Start API: python api.py")
262
- print(" 2. Access docs: http://localhost:8000/docs")
263
- print(" 3. Test endpoints: curl http://localhost:8000/health")
264
- return 0
265
- else:
266
- print(f"\n⚠️ {total - passed} test(s) failed. Please check the errors above.")
267
- return 1
268
-
269
- if __name__ == "__main__":
270
- sys.exit(main())