File size: 3,713 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# πŸš€ Quick Deployment Guide

## 🎯 Choose Your Deployment Method

### 🟒 **Option 1: Quick Demo (Recommended for Interviews)**
Perfect for demonstrations and quick testing.

**Windows:**
```bash
# Double-click or run:
start_demo.bat
```

**Linux/Mac:**
```bash
./start_demo.sh
```

**What it does:**
- Starts backend on port 8001
- Starts frontend on port 8501
- Opens browser automatically
- Shows progress in separate windows

---

### 🟑 **Option 2: Docker Deployment (Recommended for Production)**
Professional containerized deployment.

**Prerequisites:**
- Install [Docker Desktop](https://www.docker.com/products/docker-desktop)

**Windows:**
```bash
# Double-click or run:
deploy_docker.bat
```

**Linux/Mac:**
```bash
./deploy_docker.sh
```

**What it does:**
- Builds Docker containers
- Sets up networking
- Provides health checks
- Includes nginx reverse proxy (optional)

---

## πŸ“Š **Check Deployment Status**

**Windows:**
```bash
check_status.bat
```

**Linux/Mac:**
```bash
curl http://localhost:8001/    # Backend health
curl http://localhost:8501/    # Frontend health
```

---

## πŸ”— **Access Your Application**

Once deployed, access these URLs:

- **🎨 Frontend UI:** http://localhost:8501
- **⚑ Backend API:** http://localhost:8001  
- **πŸ“š API Documentation:** http://localhost:8001/docs

---

## πŸ›‘ **Stop Services**

**Quick Demo:**
- Windows: Run `stop_services.bat` or close command windows
- Linux/Mac: Press `Ctrl+C` in terminal

**Docker:**
```bash
docker-compose down
```

---

## πŸ†˜ **Troubleshooting**

### Common Issues:

1. **Port already in use:**
   ```bash
   # Kill existing processes
   taskkill /f /im python.exe     # Windows
   pkill -f python                # Linux/Mac
   ```

2. **Models not loading:**
   - Check if `models/indictrans2/` directory exists
   - Ensure models were downloaded properly
   - Check backend logs for errors

3. **Frontend can't connect to backend:**
   - Verify backend is running on port 8001
   - Check `frontend/app.py` has correct API_BASE_URL

4. **Docker issues:**
   ```bash
   # Check Docker status
   docker ps
   docker-compose logs
   
   # Reset Docker
   docker-compose down
   docker system prune -f
   docker-compose up --build
   ```

---

## πŸ”§ **Configuration**

### Environment Variables:
Create `.env` file in root directory:
```bash
MODEL_TYPE=indictrans2
MODEL_PATH=models/indictrans2
DEVICE=cpu
DATABASE_PATH=data/translations.db
```

### For Production:
- Copy `.env.production` to `.env`
- Update database settings
- Configure CORS origins
- Set up monitoring

---

## πŸ“ˆ **Performance Tips**

1. **Use GPU if available:**
   ```bash
   DEVICE=cuda  # in .env file
   ```

2. **Increase memory for Docker:**
   - Docker Desktop β†’ Settings β†’ Resources β†’ Memory: 8GB+

3. **Monitor resource usage:**
   ```bash
   docker stats           # Docker containers
   htop                   # System resources
   ```

---

## πŸŽ‰ **Success Indicators**

βœ… **Deployment Successful When:**
- Backend responds at http://localhost:8001
- Frontend loads at http://localhost:8501  
- Can translate "Hello" to Hindi
- API docs accessible at http://localhost:8001/docs
- No error messages in logs

---

## πŸ†˜ **Need Help?**

1. Check the logs:
   - Quick Demo: Look at command windows
   - Docker: `docker-compose logs -f`

2. Verify prerequisites:
   - Python 3.11+ installed
   - All dependencies in requirements.txt
   - Models downloaded in correct location

3. Test individual components:
   - Backend: `curl http://localhost:8001/`
   - Frontend: Open browser to http://localhost:8501

---

**🎯 For Interview Demos: Use Quick Demo option - it's fastest and shows everything working!**