RLikhitha commited on
Commit
165831c
·
verified ·
1 Parent(s): d088c59

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +70 -0
app.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ EduTutor AI - Main Application Entry Point
3
+ Simplified main file to avoid ClamAV issues
4
+ """
5
+
6
+ import subprocess
7
+ import sys
8
+
9
+ def install_requirements():
10
+ """Install required packages if not available"""
11
+ required_packages = [
12
+ 'torch', 'transformers', 'huggingface-hub',
13
+ 'gradio', 'sympy', 'numpy'
14
+ ]
15
+
16
+ for package in required_packages:
17
+ try:
18
+ __import__(package)
19
+ except ImportError:
20
+ print(f"Installing {package}...")
21
+ subprocess.check_call([sys.executable, "-m", "pip", "install", package])
22
+
23
+ # Install requirements before importing
24
+ install_requirements()
25
+
26
+ # Import our modular components
27
+ from core.tutor_ai import EduTutorAI
28
+ from core.features import EducationalFeatures
29
+ from interface.gradio_app import create_gradio_interface
30
+ from utils.setup import setup_environment
31
+
32
+ def main():
33
+ """Main function to run the EduTutor AI application"""
34
+ print("🎓 Starting EduTutor AI Application...")
35
+
36
+ # Setup environment
37
+ setup_environment()
38
+
39
+ # Initialize components
40
+ ai_tutor = EduTutorAI()
41
+ features = EducationalFeatures(ai_tutor)
42
+
43
+ # Load model
44
+ model_ready = ai_tutor.load_model()
45
+ if not model_ready:
46
+ print("⚠️ Warning: AI model failed to load. Using fallback responses.")
47
+
48
+ # Create and launch interface
49
+ print("🌐 Creating web interface...")
50
+ gradio_app = create_gradio_interface(ai_tutor, features)
51
+
52
+ print("🚀 Launching EduTutor AI on port 7860...")
53
+ print("🌟 EduTutor AI is now ready!")
54
+ print("💡 Features available:")
55
+ print(" • 🤖 AI Chat Tutor")
56
+ print(" • 📊 Advanced Homework Analyzer")
57
+ print(" • 📝 Interactive Quizzes")
58
+ print(" • 📋 Study Plan Generator")
59
+ print(" • 📈 Progress Tracking")
60
+
61
+ gradio_app.launch(
62
+ server_port=7860,
63
+ server_name="0.0.0.0",
64
+ share=True,
65
+ show_error=True,
66
+ quiet=False
67
+ )
68
+
69
+ if __name__ == "__main__":
70
+ main()