Spaces:
Sleeping
Sleeping
| """ | |
| Setup script to create required directories for OpenEnv project. | |
| Run: python setup_dirs.py | |
| """ | |
| import os | |
| from pathlib import Path | |
| def create_directories(): | |
| """Create all required directories for the project.""" | |
| # Get the project root (where this script is) | |
| project_root = Path(__file__).parent | |
| # Directories to create | |
| directories = [ | |
| "outputs", | |
| "outputs/logs", | |
| "outputs/results", | |
| "outputs/checkpoints", | |
| "outputs/visualizations", | |
| "logs", | |
| "data", | |
| "data/raw", | |
| "data/processed", | |
| "configs", | |
| ] | |
| print(f"Setting up directories in: {project_root}") | |
| print("-" * 50) | |
| for dir_path in directories: | |
| full_path = project_root / dir_path | |
| if not full_path.exists(): | |
| full_path.mkdir(parents=True, exist_ok=True) | |
| print(f"β Created: {dir_path}") | |
| else: | |
| print(f"β Already exists: {dir_path}") | |
| print("-" * 50) | |
| print("β Directory setup complete!") | |
| # Also create a .gitkeep file to keep empty directories in git | |
| gitkeep_path = project_root / "outputs" / ".gitkeep" | |
| if not gitkeep_path.exists(): | |
| with open(gitkeep_path, 'w') as f: | |
| f.write("# This directory is for outputs\n") | |
| print(f"β Created: outputs/.gitkeep") | |
| def check_environment(): | |
| """Check if environment is properly configured.""" | |
| print("\n" + "="*50) | |
| print("Environment Check") | |
| print("="*50) | |
| # Check Python version | |
| import sys | |
| print(f"Python version: {sys.version}") | |
| # Check for .env file | |
| env_file = Path(__file__).parent / ".env" | |
| if env_file.exists(): | |
| print("β .env file found") | |
| else: | |
| print("β οΈ .env file not found (optional)") | |
| print(" Create .env with: HF_TOKEN=your_token_here") | |
| # Check for required packages | |
| required_packages = ["openai", "requests", "fastapi", "uvicorn"] | |
| for package in required_packages: | |
| try: | |
| __import__(package) | |
| print(f"β {package} installed") | |
| except ImportError: | |
| print(f"β {package} not installed") | |
| print(f" Install with: pip install {package}") | |
| # Check openenv | |
| try: | |
| import openenv | |
| print(f"β openenv installed (version: {openenv.__version__ if hasattr(openenv, '__version__') else 'unknown'})") | |
| except ImportError: | |
| print("β openenv not installed") | |
| print(" Install with: pip install openenv") | |
| if __name__ == "__main__": | |
| create_directories() | |
| check_environment() | |
| print("\n" + "="*50) | |
| print("Next Steps:") | |
| print("="*50) | |
| print("1. Start the server: python server/app.py") | |
| print("2. Run inference: python inference.py --mode rule") | |
| print("3. Run LLM: python inference.py --mode llm") | |
| print("="*50) |