Spaces:
Sleeping
Sleeping
File size: 4,690 Bytes
bb8f662 | 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 191 192 193 194 195 196 197 | # Quick Start Guide - VQA Mobile App
This guide will help you get the VQA mobile app running quickly.
## Prerequisites Checklist
- [ ] Python 3.8+ installed
- [ ] Node.js 16+ installed
- [ ] VQA model checkpoints available
- [ ] Smartphone with Expo Go app installed
- [ ] Computer and phone on same WiFi network
## Step-by-Step Setup
### Step 1: Start the Backend Server
```bash
# Open terminal/PowerShell
cd c:\Users\rdeva\Downloads\vqa_coes
# Install backend dependencies (first time only)
pip install -r requirements_api.txt
# Start the server
python backend_api.py
```
**Expected output:**
```
π INITIALIZING ENSEMBLE VQA SYSTEM
βοΈ Device: cuda
π₯ Loading models...
β
Ensemble ready!
```
**Important:** Keep this terminal window open! The server must keep running.
### Step 2: Find Your Local IP Address
**Windows:**
```bash
ipconfig
```
Look for "IPv4 Address" under your WiFi adapter (e.g., `192.168.1.100`)
**Mac/Linux:**
```bash
ifconfig
# or
ip addr
```
### Step 3: Configure the Mobile App
1. Open `ui/src/config/api.js`
2. Replace the IP address:
```javascript
export const API_BASE_URL = 'http://YOUR_IP_HERE:8000';
// Example: export const API_BASE_URL = 'http://192.168.1.100:8000';
```
### Step 4: Configure Google OAuth (Optional for Testing)
**For testing without Google login**, you can skip this and modify the app to bypass authentication.
**For full Google login:**
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a project
3. Enable Google+ API
4. Create OAuth 2.0 credentials
5. Update `ui/src/config/google.js` with your client IDs
### Step 5: Start the Mobile App
```bash
# Open a NEW terminal/PowerShell
cd c:\Users\rdeva\Downloads\vqa_coes\ui
# Start Expo
npm start
```
**Expected output:**
```
Metro waiting on exp://192.168.1.100:8081
βΊ Scan the QR code above with Expo Go (Android) or the Camera app (iOS)
```
### Step 6: Run on Your Phone
1. **Install Expo Go** on your phone:
- [Android - Play Store](https://play.google.com/store/apps/details?id=host.exp.exponent)
- [iOS - App Store](https://apps.apple.com/app/expo-go/id982107779)
2. **Scan the QR code**:
- Android: Open Expo Go app β Scan QR code
- iOS: Open Camera app β Scan QR code β Tap notification
3. **Wait for app to load** (first time may take 1-2 minutes)
## Testing Without Google Login
If you want to test the VQA functionality without setting up Google OAuth:
1. Open `ui/App.js`
2. Temporarily modify the navigation to always show HomeScreen:
```javascript
// Replace this:
{user ? (
<Stack.Screen name="Home" component={HomeScreen} />
) : (
<Stack.Screen name="Login" component={LoginScreen} />
)}
// With this:
<Stack.Screen name="Home" component={HomeScreen} />
```
3. Restart the Expo server
## Testing the App
### Test 1: General Question (Base Model)
1. Tap "Gallery" and select an image
2. Enter question: "What color is the car?"
3. Tap "Ask Question"
4. Should show: π Base Model
### Test 2: Spatial Question (Spatial Model)
1. Select an image with multiple objects
2. Enter question: "What is to the right of the table?"
3. Tap "Ask Question"
4. Should show: π Spatial Model
## Troubleshooting
### "Cannot connect to server"
- β
Check backend is running
- β
Verify IP address in `api.js` is correct
- β
Ensure phone and computer on same WiFi
- β
Check firewall isn't blocking port 8000
### "Model not loaded"
- β
Check checkpoint files are in project root
- β
Verify file names: `vqa_checkpoint.pt` and `vqa_spatial_checkpoint.pt`
- β
Check backend terminal for error messages
### App won't load on phone
- β
Ensure Expo Go is installed
- β
Check both devices on same network
- β
Try restarting Expo server (Ctrl+C, then `npm start`)
- β
Clear Expo cache: `npm start -- --clear`
### "Permission denied" for camera/gallery
- β
Grant permissions when prompted
- β
Check phone settings β App permissions
## Next Steps
Once everything works:
1. **Set up Google OAuth** for production use
2. **Customize the UI** in `src/styles/theme.js`
3. **Add custom icons** in `assets/` folder
4. **Build standalone app** with `eas build`
## Quick Commands Reference
```bash
# Start backend
cd c:\Users\rdeva\Downloads\vqa_coes
python backend_api.py
# Start mobile app
cd c:\Users\rdeva\Downloads\vqa_coes\ui
npm start
# Clear Expo cache
npm start -- --clear
# Install new package
npm install package-name
# Check backend health
curl http://localhost:8000/health
```
## Support
If you encounter issues:
1. Check the main README.md
2. Review backend terminal logs
3. Check Expo console for errors
4. Verify all prerequisites are met
|