File size: 2,456 Bytes
2cb386d
5f613ea
2cb386d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f613ea
2cb386d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f613ea
2cb386d
 
 
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
"""
Launcher script for SkillSprout
Runs both the Gradio interface and MCP server
"""

import asyncio
import subprocess
import sys
import time
import threading
from pathlib import Path

def run_gradio_app():
    """Run the main Gradio application"""
    print("πŸš€ Starting Gradio App...")
    subprocess.run([sys.executable, "app.py"])

def run_mcp_server():
    """Run the MCP server"""
    print("πŸ”— Starting MCP Server...")
    subprocess.run([sys.executable, "mcp_server.py"])

def main():
    """Main launcher function"""
    print("=" * 60)
    print("🌱 SKILLSPROUT")
    print("   AI-Powered Microlearning Platform")
    print("=" * 60)
    print()
    
    # Check if we're in the right directory
    if not Path("app.py").exists():
        print("❌ Error: app.py not found. Please run this script from the project directory.")
        return
    
    print("Choose how to run the application:")
    print("1. Gradio App only (recommended for demo)")
    print("2. MCP Server only")
    print("3. Both Gradio App and MCP Server")
    print()
    
    choice = input("Enter your choice (1-3): ").strip()
    
    if choice == "1":
        print("\n🎯 Starting Gradio App...")
        print("πŸ“± Interface will be available at: http://localhost:7860")
        run_gradio_app()
    
    elif choice == "2":
        print("\nπŸ”— Starting MCP Server...")
        print("🌐 API will be available at: http://localhost:8000")
        print("πŸ“š API docs at: http://localhost:8000/docs")
        run_mcp_server()
    
    elif choice == "3":
        print("\nπŸš€ Starting both services...")
        print("πŸ“± Gradio App: http://localhost:7860")
        print("🌐 MCP Server: http://localhost:8000")
        print("πŸ“š API docs: http://localhost:8000/docs")
        print()
        
        # Start MCP server in a separate thread
        mcp_thread = threading.Thread(target=run_mcp_server, daemon=True)
        mcp_thread.start()
        
        # Give MCP server time to start
        time.sleep(2)
        
        # Start Gradio app (this will block)
        run_gradio_app()
    
    else:
        print("❌ Invalid choice. Please run the script again.")

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        print("\n\nπŸ‘‹ Goodbye! Thanks for using SkillSprout!")
    except Exception as e:
        print(f"\n❌ Error: {e}")
        print("Please check your configuration and try again.")