limasource
Add application files
518e57c
#!/usr/bin/env python3
"""
AI Agent Brainstorming Studio Setup Script
==========================================
Quick setup script for installing all dependencies and verifying the installation.
"""
import subprocess
import sys
import os
from pathlib import Path
def run_command(command, description):
"""Run a command and handle errors gracefully"""
print(f"πŸ”§ {description}...")
try:
result = subprocess.run(command, shell=True, capture_output=True, text=True)
if result.returncode == 0:
print(f"βœ… {description} completed successfully")
return True
else:
print(f"❌ Error in {description}: {result.stderr}")
return False
except Exception as e:
print(f"❌ Error running {description}: {e}")
return False
def check_python_version():
"""Check if Python version is compatible"""
version = sys.version_info
if version.major >= 3 and version.minor >= 10:
print(f"βœ… Python {version.major}.{version.minor}.{version.micro} is compatible")
return True
else:
print(f"❌ Python {version.major}.{version.minor}.{version.micro} is not compatible. Need Python 3.10+")
return False
def setup_environment():
"""Set up the AI Agent Brainstorming Studio environment"""
print("🧠 AI Agent Brainstorming Studio Setup")
print("=" * 40)
# Check Python version
if not check_python_version():
print("\nπŸ”§ Please upgrade Python to version 3.10 or higher")
print(" Download from: https://www.python.org/downloads/")
return False
# Upgrade pip
if not run_command("python -m pip install --upgrade pip", "Upgrading pip"):
return False
# Install requirements
requirements_file = "requirements.txt"
if Path(requirements_file).exists():
if not run_command(f"pip install -r {requirements_file}", "Installing dependencies"):
return False
else:
print(f"❌ Requirements file '{requirements_file}' not found")
return False
# Download NLTK data
print("πŸ”§ Downloading NLTK data...")
try:
import nltk
nltk.download('punkt', quiet=True)
nltk.download('stopwords', quiet=True)
nltk.download('vader_lexicon', quiet=True)
print("βœ… NLTK data downloaded successfully")
except Exception as e:
print(f"⚠️ NLTK data download failed: {e}")
print(" This is optional - the system will still work")
# Test imports
print("πŸ”§ Testing key imports...")
try:
import gradio
import openai
import mcp
import plotly
import sklearn
import nltk
import textblob
print("βœ… All key imports successful")
except ImportError as e:
print(f"❌ Import test failed: {e}")
return False
# Check for .env file
if not Path(".env").exists():
print("\nπŸ’‘ Optional: Create .env file for OpenAI API key")
print(" echo 'OPENAI_API_KEY=sk-your-key-here' > .env")
print(" (Or enter it in the web interface)")
print("\nπŸŽ‰ Setup Complete!")
print("πŸ“‹ Next Steps:")
print(" 1. (Optional) Add OpenAI API key to .env file or web interface")
print(" 2. Run: python app.py")
print(" 3. Open: http://localhost:7864")
print(" 4. Start brainstorming with AI agents!")
return True
if __name__ == "__main__":
success = setup_environment()
if not success:
print("\n❌ Setup failed. Please check the errors above.")
sys.exit(1)
else:
print("\nβœ… Ready to launch your AI Agent Brainstorming Studio!")
# Ask if user wants to launch immediately
try:
launch = input("\nπŸš€ Launch the brainstorming studio now? (y/N): ").lower().strip()
if launch in ['y', 'yes']:
print("πŸš€ Launching AI Agent Brainstorming Studio...")
os.system("python app.py")
except KeyboardInterrupt:
print("\nπŸ‘‹ Setup complete. Run 'python app.py' when ready!")