Spaces:
Sleeping
Sleeping
File size: 4,164 Bytes
518e57c |
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 |
#!/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!") |