File size: 2,042 Bytes
67f25fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash

echo "========================================"
echo "  Multi-Lingual Catalog Translator"
echo "  Quick Demo Deployment"
echo "========================================"
echo

echo "πŸ”§ Checking prerequisites..."
if ! command -v python3 &> /dev/null; then
    echo "❌ Python3 not found! Please install Python 3.11+"
    exit 1
fi

echo "βœ… Python3 found"
echo

# Function to cleanup on exit
cleanup() {
    echo
    echo "πŸ›‘ Stopping services..."
    if [ ! -z "$BACKEND_PID" ]; then
        kill $BACKEND_PID 2>/dev/null
    fi
    if [ ! -z "$FRONTEND_PID" ]; then
        kill $FRONTEND_PID 2>/dev/null
    fi
    echo "βœ… Services stopped"
    exit 0
}

# Setup signal handlers
trap cleanup SIGINT SIGTERM

echo "πŸš€ Starting Backend Server..."
cd backend
echo "Starting Backend API on port 8001..."
uvicorn main:app --host 0.0.0.0 --port 8001 &
BACKEND_PID=$!
cd ..

echo
echo "⏳ Waiting for backend to initialize (15 seconds)..."
sleep 15

echo
echo "🎨 Starting Frontend Server..."
cd frontend
echo "Starting Streamlit Frontend on port 8501..."
streamlit run app.py --server.port 8501 &
FRONTEND_PID=$!
cd ..

echo
echo "βœ… Deployment Complete!"
echo
echo "πŸ“± Access your application:"
echo "πŸ”— Frontend UI:    http://localhost:8501"
echo "πŸ”— Backend API:    http://localhost:8001"
echo "πŸ”— API Docs:       http://localhost:8001/docs"
echo
echo "πŸ’‘ Tips:"
echo "- Wait 30-60 seconds for models to load"
echo "- Check logs below for loading progress"
echo "- Press Ctrl+C to stop all services"
echo
echo "πŸŽ‰ Application is now running!"
echo "Opening frontend in browser..."

# Try to open browser (works on most systems)
if command -v xdg-open &> /dev/null; then
    xdg-open http://localhost:8501
elif command -v open &> /dev/null; then
    open http://localhost:8501
else
    echo "Please open http://localhost:8501 in your browser"
fi

echo
echo "πŸ“Š Monitoring logs (Press Ctrl+C to stop):"
echo "----------------------------------------"

# Wait for processes to finish or for interrupt
wait