-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
49 lines (41 loc) · 1.37 KB
/
setup.py
File metadata and controls
49 lines (41 loc) · 1.37 KB
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
"""
Setup script for the AI Image Generator
"""
import subprocess
import sys
import os
def install_requirements():
"""Install required packages"""
print("Installing required packages...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("✓ Requirements installed successfully!")
except subprocess.CalledProcessError as e:
print(f"✗ Error installing requirements: {e}")
return False
return True
def setup_env_file():
"""Setup environment file"""
env_file = ".env"
if not os.path.exists(env_file):
print("Creating .env file...")
with open(env_file, "w") as f:
f.write("# Add your OpenAI API key here\n")
f.write("OPENAI_API_KEY=your_api_key_here\n")
print("✓ .env file created. Please edit it and add your OpenAI API key.")
else:
print("✓ .env file already exists.")
def main():
print("=== AI Image Generator Setup ===")
# Install requirements
if not install_requirements():
return
# Setup environment file
setup_env_file()
print("\n=== Setup Complete ===")
print("Next steps:")
print("1. Edit the .env file and add your OpenAI API key")
print("2. Run: python main.py")
print("\nEnjoy generating pixelated images!")
if __name__ == "__main__":
main()