File size: 31,442 Bytes
0b0b4c4 75ba58d 0b0b4c4 75ba58d 0b0b4c4 75ba58d 0b0b4c4 1df77cc 0b0b4c4 75ba58d 0b0b4c4 75ba58d 0b0b4c4 75ba58d 0b0b4c4 75ba58d 0b0b4c4 0cef88e 0b0b4c4 0cef88e 75ba58d 0b0b4c4 75ba58d 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 8c68851 0b0b4c4 0cef88e 0b0b4c4 0cef88e 0b0b4c4 75ba58d 0b0b4c4 1df77cc 0b0b4c4 1df77cc 0b0b4c4 1df77cc 0b0b4c4 1df77cc 0b0b4c4 1df77cc 0b0b4c4 1df77cc 0b0b4c4 1df77cc 0b0b4c4 1df77cc 0b0b4c4 75ba58d 0b0b4c4 75ba58d f8584c3 bdd1932 | 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | #!/usr/bin/env python3
"""
๐ฏ EKALAVYA - The Ultimate AI Teaching Assistant
๐ Multi-Modal โข Multi-Lingual โข Memory-Powered
๐ก๏ธ Safe โข ๐ Educational โข ๐ Friendly
"""
from fastapi import FastAPI, HTTPException, UploadFile, File, Form
from fastapi.responses import HTMLResponse
from pydantic import BaseModel
from typing import Optional, List, Dict
import json
import os
# Import all modules
from model.teaching import TeachingMode
from model.safety import SafetyRules
from model.memory import MemorySystem
# ๐ฏ Initialize FastAPI with style
app = FastAPI(
title="๐ฏ EKALAVYA API",
description="๐ The Ultimate AI Teaching Assistant - Multi-Modal, Multi-Lingual, Memory-Powered",
version="3.0.0",
docs_url="/docs",
redoc_url="/redoc"
)
# ๐ก๏ธ Initialize safety rules
safety = SafetyRules()
# ๐ฏ Initialize teaching mode
teaching_mode = TeachingMode(style="friend")
# ๐ Data directory
DATA_DIR = "data"
os.makedirs(DATA_DIR, exist_ok=True)
# ๐ฆ Request/Response Models
class TeachingRequest(BaseModel):
"""๐ Teaching request model"""
input_text: str
user_id: str = "default_user"
conversation_style: str = "friend" # friend, teacher, lover, mentor
language: str = "english"
class SafetyCheckRequest(BaseModel):
"""๐ก๏ธ Safety check request model"""
content: str
check_type: str = "all" # all, scam, hacking, privacy, inappropriate
class ProgressRequest(BaseModel):
"""๐ Progress request model"""
user_id: str
class StyleRequest(BaseModel):
"""๐ Conversation style request model"""
style: str # friend, teacher, lover, mentor
user_id: str = "default_user"
# ๐ Root endpoint
@app.get("/", response_class=HTMLResponse)
async def root():
"""๐ฏ Welcome page with emojis"""
return """
<!DOCTYPE html>
<html>
<head>
<title>๐ฏ EKALAVYA - AI Teaching Assistant</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 50px auto;
padding: 20px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.card {
background: rgba(255,255,255,0.95);
color: #333;
padding: 30px;
border-radius: 20px;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
margin: 20px 0;
}
h1 { font-size: 3em; text-align: center; }
.emoji { font-size: 1.5em; }
.feature {
background: #f0f0f0;
padding: 15px;
margin: 10px 0;
border-radius: 10px;
border-left: 5px solid #667eea;
}
.stats {
display: flex;
justify-content: space-around;
margin: 30px 0;
}
.stat {
text-align: center;
padding: 20px;
background: rgba(255,255,255,0.1);
border-radius: 15px;
flex: 1;
margin: 0 10px;
}
.stat-number { font-size: 2.5em; font-weight: bold; }
a { color: #667eea; text-decoration: none; font-weight: bold; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="card">
<h1>๐ฏ EKALAVYA</h1>
<p style="text-align: center; font-size: 1.3em;">
๐ The Ultimate AI Teaching Assistant ๐
</p>
<div class="stats">
<div class="stat">
<div class="stat-number">๐ 23</div>
<div>Indian Languages</div>
</div>
<div class="stat">
<div class="stat-number">๐ง 1M</div>
<div>Token Context</div>
</div>
<div class="stat">
<div class="stat-number">๐ก๏ธ 100%</div>
<div>Safe & Private</div>
</div>
</div>
<h2>โจ Features</h2>
<div class="feature">
<span class="emoji">๐</span> <strong>Teaching Mode</strong>
<p>Learn English with real-time mistake detection and correction</p>
</div>
<div class="feature">
<span class="emoji">๐ง </span> <strong>Memory System</strong>
<p>Remembers your mistakes and tracks your learning progress</p>
</div>
<div class="feature">
<span class="emoji">๐</span> <strong>Conversation Styles</strong>
<p>Choose: Friend ๐ซ, Teacher ๐จโ๐ซ, Lover ๐, or Mentor ๐</p>
</div>
<div class="feature">
<span class="emoji">๐ก๏ธ</span> <strong>Safety First</strong>
<p>Scam detection, hacking prevention, privacy protection</p>
</div>
<div class="feature">
<span class="emoji">๐</span> <strong>Multi-Modal</strong>
<p>Supports text, images, video, and audio</p>
</div>
<div class="feature">
<span class="emoji">๐</span> <strong>100% Private</strong>
<p>All data stays on your device, no tracking</p>
</div>
<h2>๐ API Endpoints</h2>
<div class="feature">
<strong>POST /teach</strong> - Start learning session
</div>
<div class="feature">
<strong>POST /safety/check</strong> - Check content safety
</div>
<div class="feature">
<strong>GET /safety/tips</strong> - Get safety tips
</div>
<div class="feature">
<strong>POST /progress</strong> - View learning progress
</div>
<div class="feature">
<strong>POST /style</strong> - Change conversation style
</div>
<h2>๐ Quick Links</h2>
<p>
๐ <a href="/docs">Interactive API Docs</a> |
๐ <a href="/redoc">Alternative Docs</a> |
๐ฏ <a href="https://huggingface.co/hackerbhai/vinaymodel">HuggingFace Model</a>
</p>
<p style="text-align: center; margin-top: 30px; font-size: 1.2em;">
๐ฏ Built with โค๏ธ for learners everywhere ๐
</p>
</div>
</body>
</html>
"""
# ๐ Teaching endpoint
@app.post("/teach")
async def teach(request: TeachingRequest):
"""๐ Start teaching session with mistake detection"""
try:
# ๐ก๏ธ Safety check first
safety_check = safety.check_content(request.input_text)
if not safety_check['is_safe']:
return {
"status": "๐ก๏ธ safety_warning",
"message": safety_check['warnings'][0],
"suggestions": safety_check['suggestions']
}
# ๐ฏ Process teaching request
result = teaching_mode.process_teaching_request(
user_input=request.input_text,
user_id=request.user_id,
conversation_style=request.conversation_style,
language=request.language
)
return {
"status": "โ
success",
"response": result['response'],
"mistakes_found": result['mistakes'],
"corrections": result['corrections'],
"explanation": result['explanation'],
"encouragement": result['encouragement'],
"next_steps": result['next_steps'],
"emoji": "๐" if result['mistakes'] else "โจ"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Error: {str(e)}")
# ๐ก๏ธ Safety check endpoint
@app.post("/safety/check")
async def check_safety(request: SafetyCheckRequest):
"""๐ก๏ธ Check if content is safe"""
result = safety.check_content(request.content)
return {
"is_safe": result['is_safe'],
"violations": result['violations'],
"warnings": result['warnings'],
"suggestions": result['suggestions'],
"emoji": "โ
" if result['is_safe'] else "โ ๏ธ",
"message": "โ
Content is safe!" if result['is_safe'] else "โ ๏ธ Safety issues detected"
}
# ๐ก Safety tips endpoint
@app.get("/safety/tips")
async def get_safety_tips():
"""๐ก Get safety tips with emojis"""
tips = safety.get_safety_tips()
emoji_tips = [
f"๐ {tips['privacy_protection'][0]}",
f"๐ก๏ธ {tips['privacy_protection'][1]}",
f"๐ซ {tips['prohibited_actions'][0]}",
f"โ ๏ธ {tips['prohibited_actions'][1]}",
f"๐ {tips['positive_behaviors'][0]}",
f"๐ {tips['positive_behaviors'][1]}",
]
return {
"tips": emoji_tips,
"count": len(emoji_tips),
"emoji": "๐ก",
"message": "๐ก Stay safe with these tips!"
}
# ๐ Progress endpoint
@app.post("/progress")
async def get_progress(request: ProgressRequest):
"""๐ Get user learning progress"""
memory = MemorySystem(user_id=request.user_id)
stats = memory.get_user_stats()
# Calculate learning score
total_attempts = stats['total_attempts']
correct_attempts = stats['correct_attempts']
learning_score = (correct_attempts / total_attempts * 100) if total_attempts > 0 else 0
return {
"user_id": request.user_id,
"stats": stats,
"learning_score": round(learning_score, 2),
"emoji": "๐" if learning_score > 80 else "๐" if learning_score > 50 else "๐ช",
"message": "๐ Excellent progress!" if learning_score > 80 else
"๐ Good progress, keep going!" if learning_score > 50 else
"๐ช Keep practicing, you'll improve!"
}
# ๐ Style change endpoint
@app.post("/style")
async def change_style(request: StyleRequest):
"""๐ Change conversation style"""
styles = {
"friend": "๐ซ",
"teacher": "๐จโ๐ซ",
"lover": "๐",
"mentor": "๐"
}
if request.style not in styles:
raise HTTPException(
status_code=400,
detail=f"โ Invalid style. Choose from: {', '.join(styles.keys())}"
)
teaching_mode.set_style(request.style, request.user_id)
return {
"status": "โ
success",
"style": request.style,
"emoji": styles[request.style],
"message": f"{styles[request.style]} Now talking as your {request.style}!"
}
# ๐ Languages endpoint
@app.get("/languages")
async def get_languages():
"""๐ Get supported languages with flags"""
languages = {
"english": {"name": "English", "flag": "๐ฌ๐ง", "emoji": "๐"},
"hindi": {"name": "Hindi", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"bengali": {"name": "Bengali", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"telugu": {"name": "Telugu", "flag": "๐ฎ๐ณ", "emoji": "โ๏ธ"},
"tamil": {"name": "Tamil", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"marathi": {"name": "Marathi", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"gujarati": {"name": "Gujarati", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"kannada": {"name": "Kannada", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"malayalam": {"name": "Malayalam", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"odia": {"name": "Odia", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"punjabi": {"name": "Punjabi", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"assamese": {"name": "Assamese", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"urdu": {"name": "Urdu", "flag": "๐ต๐ฐ", "emoji": "๐"},
"maithili": {"name": "Maithili", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"santali": {"name": "Santali", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"kashmiri": {"name": "Kashmiri", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"nepali": {"name": "Nepali", "flag": "๐ณ๐ต", "emoji": "๐"},
"sindhi": {"name": "Sindhi", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"konkani": {"name": "Konkani", "flag": "๐ฎ๐ณ", "emoji": "โ๏ธ"},
"dogri": {"name": "Dogri", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"manipuri": {"name": "Manipuri", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"bodo": {"name": "Bodo", "flag": "๐ฎ๐ณ", "emoji": "๐"},
"sanskrit": {"name": "Sanskrit", "flag": "๐ฎ๐ณ", "emoji": "๐"}
}
return {
"languages": languages,
"count": len(languages),
"emoji": "๐",
"message": f"๐ Supporting {len(languages)} languages!"
}
# ๐ฅ Health check endpoint
@app.get("/health")
async def health_check():
"""๐ฅ Health check with status"""
return {
"status": "โ
healthy",
"service": "๐ฏ EKALAVYA",
"version": "๐ฆ 3.0.0",
"emoji": "๐ข",
"message": "๐ข All systems operational!"
}
# ๐ฏ Main entry point
if __name__ == "__main__":
import uvicorn
print("""
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ฏ EKALAVYA - AI Teaching Assistant โ
โ โ
โ ๐ Multi-Modal โข Multi-Lingual โข Memory-Powered โ
โ โ
โ ๐ก๏ธ Safe โข ๐ Educational โข ๐ Friendly โ
โ โ
โ ๐ API Docs: http://localhost:8000/docs โ
โ โ
โ ๐ Supporting 23 Indian Languages โ
โ โ
โ ๐ง 1M Token Context Window โ
โ โ
โ ๐ 100% Private & Secure โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
""")
uvicorn.run(app, host="0.0.0.0", port=8000)
# ๐ฅ VIDEO AI ENDPOINTS
from model.video_ai import VideoAnalyzer, CameraProcessor
# ๐ฌ Initialize video AI
video_analyzer = VideoAnalyzer()
camera_processor = CameraProcessor()
class VideoRequest(BaseModel):
"""๐ฅ Video processing request"""
video_path: str
operation: str = "analyze" # analyze, enhance, stabilize, remove_objects, extract_info
class RealTimeVideoRequest(BaseModel):
"""๐บ Real-time video request"""
source: int = 0 # 0 for camera, other for screen
duration: int = 30 # seconds
# ๐ฌ Video Analysis endpoint
@app.post("/video/analyze")
async def analyze_video(request: VideoRequest):
"""๐ฌ Analyze video content with AI"""
try:
result = video_analyzer.analyze_video_content(request.video_path)
return {
"status": "โ
success",
"analysis": result,
"emoji": "๐ฌ",
"message": "๐ฌ Video analysis complete!"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Video analysis failed: {str(e)}")
# ๐จ Video Enhancement endpoint
@app.post("/video/enhance")
async def enhance_video(request: VideoRequest):
"""๐ฏ Enhance video quality"""
try:
output_path = f"enhanced_{request.video_path.split('/')[-1]}"
result = video_analyzer.enhance_video_quality(request.video_path, output_path)
return {
"status": "โ
success",
"output_file": output_path,
"enhancements": result["enhancements"],
"emoji": "๐ฏ",
"message": "๐ฏ Video enhanced successfully!"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Video enhancement failed: {str(e)}")
# ๐บ Video Stabilization endpoint
@app.post("/video/stabilize")
async def stabilize_video(request: VideoRequest):
"""๐บ Stabilize shaky video"""
try:
output_path = f"stabilized_{request.video_path.split('/')[-1]}"
result = video_analyzer.stabilize_video(request.video_path, output_path)
return {
"status": "โ
success",
"output_file": output_path,
"stabilization_level": result["stabilization_level"],
"emoji": "๐บ",
"message": "๐บ Video stabilized successfully!"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Video stabilization failed: {str(e)}")
# ๐จ Object Removal endpoint
@app.post("/video/remove-objects")
async def remove_objects(request: VideoRequest):
"""๐จ Remove objects from video"""
try:
output_path = f"cleaned_{request.video_path.split('/')[-1]}"
result = video_analyzer.remove_objects(request.video_path, output_path)
return {
"status": "โ
success",
"output_file": output_path,
"frames_processed": result["frames_processed"],
"emoji": "๐จ",
"message": "๐จ Objects removed successfully!"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Object removal failed: {str(e)}")
# ๐ Information Extraction endpoint
@app.post("/video/extract-info")
async def extract_video_info(request: VideoRequest):
"""๐ Extract information from video"""
try:
result = video_analyzer.extract_information(request.video_path)
return {
"status": "โ
success",
"extracted_info": result,
"emoji": "๐",
"message": "๐ Information extracted successfully!"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Information extraction failed: {str(e)}")
# ๐บ Real-time Video Analysis endpoint
@app.post("/video/realtime")
async def real_time_video(request: RealTimeVideoRequest):
"""๐บ Real-time video analysis from camera or screen"""
try:
result = video_analyzer.real_time_analysis(source=request.source)
return {
"status": "โ
success",
"frames_analyzed": result["frames_analyzed"],
"analysis_results": result["analysis_results"][:10], # Last 10 results
"emoji": "๐บ",
"message": "๐บ Real-time analysis complete!"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Real-time analysis failed: {str(e)}")
# ๐ท Camera Processing endpoint
@app.post("/camera/process")
async def process_camera():
"""๐ท Process camera frame for visual recognition"""
try:
# Capture frame from camera
import cv2
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
cap.release()
if not ret:
raise HTTPException(status_code=500, detail="โ Cannot capture from camera")
# Process frame
result = camera_processor.process_camera_frame(frame)
recognition = camera_processor.recognize_visual_elements(frame)
return {
"status": "โ
success",
"frame_analysis": result,
"visual_recognition": recognition,
"emoji": "๐ท",
"message": "๐ท Camera frame processed successfully!"
}
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Camera processing failed: {str(e)}")
# ๐ฅ Video Features Summary endpoint
@app.get("/video/features")
async def get_video_features():
"""๐ฅ Get all video AI features"""
features = {
"video_analysis": {
"emoji": "๐ฌ",
"description": "Understand and analyze video content",
"capabilities": [
"Scene detection",
"Object recognition",
"Motion analysis",
"Quality assessment",
"Content classification"
]
},
"video_enhancement": {
"emoji": "๐ฏ",
"description": "Enhance video quality",
"capabilities": [
"Brightness adjustment",
"Color correction",
"Sharpening",
"Contrast enhancement",
"Noise reduction"
]
},
"video_stabilization": {
"emoji": "๐บ",
"description": "Stabilize shaky video",
"capabilities": [
"Motion compensation",
"Frame alignment",
"Smooth transitions",
"Jitter removal",
"Professional stabilization"
]
},
"object_removal": {
"emoji": "๐จ",
"description": "Remove unwanted objects",
"capabilities": [
"Object detection",
"Smart inpainting",
"Background reconstruction",
"Seamless removal",
"Batch processing"
]
},
"information_extraction": {
"emoji": "๐",
"description": "Extract information from video",
"capabilities": [
"Text recognition (OCR)",
"Data extraction",
"Pattern detection",
"Key moment identification",
"Metadata analysis"
]
},
"real_time_analysis": {
"emoji": "๐บ",
"description": "Real-time video processing",
"capabilities": [
"Live camera feed",
"Screen share analysis",
"Instant object detection",
"Real-time classification",
"Live streaming support"
]
},
"camera_processing": {
"emoji": "๐ท",
"description": "Camera and visual recognition",
"capabilities": [
"Face detection",
"Object recognition",
"Scene classification",
"Visual element detection",
"Real-time processing"
]
}
}
return {
"features": features,
"total_features": len(features),
"emoji": "๐ฅ",
"message": "๐ฅ Complete video AI suite available!"
}
# ๐ป CODING AI ENDPOINTS
from model.coding_ai import CodingAI
# ๐งโ๐ป Initialize coding AI
coding_ai = CodingAI()
class CodingRequest(BaseModel):
"""๐ป Coding request"""
code: str
language: str = "python"
operation: str = "debug" # debug, refactor, analyze, generate
task: str = ""
class CodebaseRequest(BaseModel):
"""๐๏ธ Codebase analysis request"""
project_path: str
class AutonomousRequest(BaseModel):
"""๐ค Autonomous task request"""
task: str
project_path: str = ""
# ๐ป Code analysis endpoint
@app.post("/coding/analyze")
async def analyze_code(request: CodingRequest):
"""๐ป Analyze and debug code"""
try:
if request.operation == "debug":
result = coding_ai.debug_code(request.code, request.task)
elif request.operation == "refactor":
result = coding_ai.refactor_code(request.code, request.language, request.task)
elif request.operation == "generate":
result = coding_ai.generate_code(request.task, request.language)
else:
result = {"status": "โ unknown operation"}
return result
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Error: {str(e)}")
# ๐๏ธ Codebase analysis endpoint
@app.post("/coding/codebase")
async def analyze_codebase(request: CodebaseRequest):
"""๐๏ธ Analyze entire codebase"""
try:
result = coding_ai.analyze_codebase(request.project_path)
return result
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Error: {str(e)}")
# ๐ค Autonomous coding endpoint
@app.post("/coding/autonomous")
async def autonomous_coding(request: AutonomousRequest):
"""๐ค Execute autonomous coding task"""
try:
result = coding_ai.autonomous_task(request.task, request.project_path)
return result
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Error: {str(e)}")
# ๐ผ๏ธ VISION AI ENDPOINTS
from model.vision_ai import VisionAI
# ๐จ Initialize vision AI
vision_ai = VisionAI()
class ImageGenerationRequest(BaseModel):
"""๐จ Image generation request"""
prompt: str
style: str = "realistic"
size: List[int] = [512, 512]
class ImageAnalysisRequest(BaseModel):
"""๐๏ธ Image analysis request"""
image_data: str
class ImageProcessingRequest(BaseModel):
"""๐ง Image processing request"""
image_data: str
operation: str = "enhance" # enhance, resize, grayscale, blur, sharpen, edge_detect
# ๐จ Image generation endpoint
@app.post("/vision/generate")
async def generate_image(request: ImageGenerationRequest):
"""๐จ Generate image from text"""
try:
result = vision_ai.generate_image(
request.prompt,
request.style,
tuple(request.size)
)
return result
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Error: {str(e)}")
# ๐๏ธ Image analysis endpoint
@app.post("/vision/analyze")
async def analyze_image(request: ImageAnalysisRequest):
"""๐๏ธ Analyze image content"""
try:
result = vision_ai.analyze_image(request.image_data)
return result
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Error: {str(e)}")
# ๐ง Image processing endpoint
@app.post("/vision/process")
async def process_image(request: ImageProcessingRequest):
"""๐ง Process image"""
try:
result = vision_ai.process_image(request.image_data, request.operation)
return result
except Exception as e:
raise HTTPException(status_code=500, detail=f"โ Error: {str(e)}")
# ๐ฏ ALL CAPABILITIES ENDPOINT
@app.get("/capabilities")
async def get_all_capabilities():
"""๐ฏ Get all EKALAVYA capabilities"""
return {
"name": "๐ฏ EKALAVYA",
"version": "๐ฆ 3.0",
"status": "โ
Most Powerful AI",
"capabilities": {
"๐ป Coding": {
"emoji": "๐ป",
"features": [
"๐๏ธ Large project understanding",
"๐ง Code refactoring",
"๐ Debugging & bug fixing",
"๐ป Code generation",
"๐ค Autonomous coding agent",
"๐งช Test generation",
"๐ Documentation"
],
"better_than": "Claude, ChatGPT"
},
"๐ผ๏ธ Image": {
"emoji": "๐ผ๏ธ",
"features": [
"๐จ Image generation",
"๐๏ธ Image analysis",
"๐ง Image processing",
"๐ Visual understanding",
"๐จ Style transfer"
],
"better_than": "Gemini, ChatGPT"
},
"๐ฅ Video": {
"emoji": "๐ฅ",
"features": [
"๐ฌ Video analysis",
"๐ฏ Video enhancement",
"๐บ Video stabilization",
"๐จ Object removal",
"๐ Information extraction",
"๐บ Real-time analysis",
"๐ท Camera processing"
],
"better_than": "Gemini, Samsung, iPhone"
},
"๐ Teaching": {
"emoji": "๐",
"features": [
"๐ Mistake detection",
"โ
Instant corrections",
"๐ Detailed explanations",
"๐ช Encouragement",
"๐ฏ Personalized learning"
],
"better_than": "All others"
},
"๐ง Memory": {
"emoji": "๐ง ",
"features": [
"๐ Progress tracking",
"๐ Improvement monitoring",
"๐ฏ Weak area identification",
"๐ฌ Conversation memory",
"๐ Pattern analysis"
],
"better_than": "Claude, ChatGPT, Gemini"
},
"๐ Styles": {
"emoji": "๐",
"features": [
"๐ซ Friend style",
"๐จโ๐ซ Teacher style",
"๐ Lover style",
"๐ Mentor style"
],
"better_than": "All others (unique)"
},
"๐ Languages": {
"emoji": "๐",
"features": [
"๐ฎ๐ณ 23 Indian languages",
"๐ฌ๐ง English",
"๐ค Multi-lingual support"
],
"better_than": "All others"
},
"๐ก๏ธ Safety": {
"emoji": "๐ก๏ธ",
"features": [
"๐ก๏ธ Scam detection",
"๐ป Hacking prevention",
"๐ Privacy protection",
"โ
Ethical guidelines",
"๐ Privacy policy"
],
"better_than": "All others"
},
"๐ง Reasoning": {
"emoji": "๐ง ",
"features": [
"๐ญ Deep reasoning",
"๐ Step-by-step analysis",
"๐ฏ Problem solving",
"๐ Complex tasks"
],
"better_than": "ChatGPT"
},
"โ๏ธ Writing": {
"emoji": "โ๏ธ",
"features": [
"๐ Creative writing",
"๐ Technical writing",
"๐ฏ Precise editing",
"๐ก Style adaptation"
],
"better_than": "Claude"
}
},
"emoji": "๐",
"message": "๐ EKALAVYA - The Most Powerful AI Assistant!"
}
|