-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
56 lines (44 loc) · 1.93 KB
/
run.py
File metadata and controls
56 lines (44 loc) · 1.93 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
50
51
52
53
54
55
56
"""
Run script for the Drying Assistant application.
This script provides a convenient way to start the application.
"""
import os
import sys
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
def check_api_keys():
"""Check if the required API keys are set."""
openrouter_key = os.getenv("OPENROUTER_API_KEY")
stability_key = os.getenv("STABILITY_API_KEY")
if not openrouter_key:
print("Warning: OPENROUTER_API_KEY is not set in your .env file.")
print("Chat functionality may not work properly.")
else:
print(f"[OK] OpenRouter API key found: {openrouter_key[:5]}...{openrouter_key[-5:] if len(openrouter_key) > 10 else ''}")
if not stability_key:
print("Warning: STABILITY_API_KEY is not set in your .env file.")
print("Image drying functionality may not work properly.")
else:
print(f"[OK] Stability AI API key found: {stability_key[:5]}...{stability_key[-5:] if len(stability_key) > 10 else ''}")
return openrouter_key and stability_key
def main():
"""Main function to run the Drying Assistant application."""
print("\n=== Drying Assistant by DJ Papzin ===\n")
# Check API keys
keys_ok = check_api_keys()
if not keys_ok:
print("\nSome API keys are missing. The application may not function properly.")
response = input("Do you want to continue anyway? (y/n): ")
if response.lower() != 'y':
print("Exiting. Please set up your API keys in the .env file and try again.")
sys.exit(1)
# Import here to avoid circular imports
from src.app import DryingApp, main as app_main
print("\nStarting Drying Assistant application...")
print("The web interface will be available at http://localhost:7860")
print("Press Ctrl+C to stop the application.")
# Run the app using the main function from app.py
app_main()
if __name__ == "__main__":
main()