-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
38 lines (28 loc) · 929 Bytes
/
Copy pathrun.py
File metadata and controls
38 lines (28 loc) · 929 Bytes
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
"""
Run script for the Python AI Server
"""
import os
import sys
import logging
# Add the app directory to Python path
sys.path.append(os.path.dirname(__file__))
from app.app import app
# Ensure logs and uploads directories exist
os.makedirs('logs', exist_ok=True)
os.makedirs('uploads', exist_ok=True)
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('logs/app.log', encoding='utf-8'), # Ensure log file supports UTF-8
logging.StreamHandler() # Standard output (console)
]
)
logger = logging.getLogger(__name__)
logger.info("Starting Chat with PDF AI Server")
# Port and Debug mode from environment variables
port = int(os.getenv('FLASK_PORT', 5000))
debug = os.getenv('FLASK_DEBUG', 'false').lower() == 'true'
# Run the Flask app
app.run(host='0.0.0.0', port=port, debug=debug)