Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions webui/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,23 @@ def check_dependencies():
return True
except ImportError as e:
print(f"❌ Missing dependency: {e}")
print("Please run: pip install -r requirements.txt")
print("Please run: uv pip install -r requirements.txt")
return False


def check_uv_installed():
"""Check if uv package manager is available."""
try:
subprocess.check_call(["uv", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return True
except (subprocess.CalledProcessError, FileNotFoundError):
return False

def install_dependencies():
"""Install dependencies"""
print("Installing dependencies...")
"""Install dependencies with uv."""
print("Installing dependencies with uv...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
subprocess.check_call(["uv", "pip", "install", "-r", "requirements.txt"])
print("✅ Dependencies installation completed")
return True
except subprocess.CalledProcessError:
Expand All @@ -39,6 +48,11 @@ def main():
"""Main function"""
print("🚀 Starting Kronos Web UI...")
print("=" * 50)

if not check_uv_installed():
print("❌ uv is not installed.")
print("Install uv first: https://docs.astral.sh/uv/getting-started/installation/")
return

# Check dependencies
if not check_dependencies():
Expand All @@ -47,7 +61,7 @@ def main():
if not install_dependencies():
return
else:
print("Please manually install dependencies and retry")
print("Please manually install dependencies with uv and retry")
return

# Check model availability
Expand Down
30 changes: 19 additions & 11 deletions webui/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
echo "🚀 Starting Kronos Web UI..."
echo "================================"

# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python3 not installed, please install Python3 first"
# Check if uv is installed
if ! command -v uv &> /dev/null; then
echo "❌ uv is not installed. Please install uv first:"
echo " https://docs.astral.sh/uv/getting-started/installation/"
exit 1
fi

Expand All @@ -19,22 +20,29 @@ fi

# Check dependencies
echo "📦 Checking dependencies..."
if ! python3 -c "import flask, flask_cors, pandas, numpy, plotly" &> /dev/null; then
echo "⚠️ Missing dependencies, installing..."
pip3 install -r requirements.txt

# Create local virtual environment if it does not exist
if [ ! -d ".venv" ]; then
echo "🛠️ Creating virtual environment with uv..."
uv venv
if [ $? -ne 0 ]; then
echo "❌ Dependencies installation failed"
echo "❌ Failed to create virtual environment"
exit 1
fi
echo "✅ Dependencies installation completed"
else
echo "✅ All dependencies installed"
fi

echo "⚠️ Syncing dependencies with uv..."
uv pip install -r requirements.txt
if [ $? -ne 0 ]; then
echo "❌ Dependencies installation failed"
exit 1
fi
echo "✅ Dependencies installation completed"

# Start application
echo "🌐 Starting Web server..."
echo "Access URL: http://localhost:7070"
echo "Press Ctrl+C to stop server"
echo ""

python3 app.py
uv run app.py