Nikpatil's picture
Upload 8 files
407b660 verified
Raw History Blame Contribute Delete
2.72 kB
# #!/usr/bin/env python3
# """
# Startup script for the Document Research & Theme Identification API
# """
# import os
# import sys
# from pathlib import Path
# def check_environment():
# """Check if all required environment variables and files exist"""
# print("πŸ” Checking environment...")
# # Check for .env file
# if not Path(".env").exists():
# print("⚠️ .env file not found. Please create one based on .env.template")
# print(" You can copy: cp .env.template .env")
# return False
# # Check for Groq API key
# from dotenv import load_dotenv
# load_dotenv()
# if not os.getenv("GROQ_API_KEY"):
# print("⚠️ GROQ_API_KEY not found in environment variables")
# print(" Theme synthesis will not be available")
# print(" Get your API key from: https://console.groq.com/")
# return False
# print("βœ… Environment check passed!")
# return True
# def install_dependencies():
# """Install required dependencies"""
# print("πŸ“¦ Installing dependencies...")
# os.system("pip install -r requirements.txt")
# print("βœ… Dependencies installed!")
# def create_directories():
# """Create necessary directories"""
# print("πŸ“ Creating directories...")
# directories = ["./data", "./data/chroma_db", "./data/uploads"]
# for directory in directories:
# Path(directory).mkdir(parents=True, exist_ok=True)
# print("βœ… Directories created!")
# def main():
# """Main startup function"""
# print("πŸš€ Starting Document Research & Theme Identification API...")
# print("=" * 60)
# # Create directories
# create_directories()
# # Install dependencies
# if "--install" in sys.argv:
# install_dependencies()
# # Check environment
# env_ok = check_environment()
# print("=" * 60)
# if env_ok:
# print("πŸŽ‰ Setup complete! Starting the API server...")
# print("πŸ“ API will be available at: http://localhost:8000")
# print("πŸ“š API documentation at: http://localhost:8000/docs")
# print()
# # Start the API
# if "--dev" in sys.argv:
# os.system("uvicorn api:app --host 0.0.0.0 --port 8000 --reload")
# else:
# os.system("uvicorn api:app --host 0.0.0.0 --port 8000")
# else:
# print("❌ Setup incomplete. Please fix the issues above and try again.")
# sys.exit(1)
# if __name__ == "__main__":
# import uvicorn
# uvicorn.run("api:app", host="0.0.0.0", port=8000, reload=True)