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
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# Detailed Setup Guide for SHARP - Beginner's Edition

Welcome! This guide will walk you through setting up the SHARP 3D Prediction project on your computer, step by step. Don't worry if you're new to programming or command-line tools—we'll explain everything you need to know.

## What is SHARP?

SHARP is a tool that can take a single photograph and create a 3D representation of it, allowing you to view it from different angles. This project includes a user-friendly web interface where you can upload images and download the 3D results.

## Table of Contents

1. [Prerequisites - What You Need](#prerequisites---what-you-need)
2. [Step 1: Install Conda](#step-1-install-conda)
3. [Step 2: Download the Project](#step-2-download-the-project)
4. [Step 3: Set Up the Project](#step-3-set-up-the-project)
5. [Step 4: Start the Web Interface](#step-4-start-the-web-interface)
6. [Troubleshooting](#troubleshooting)
7. [Alternative Setup Methods](#alternative-setup-methods)

---

## Prerequisites - What You Need

Before we begin, here's what you'll need:

### Hardware Requirements
- A computer running **macOS** (for Windows or Linux, see [Alternative Setup Methods](#alternative-setup-methods))
- At least **8 GB of RAM** (16 GB or more recommended)
- At least **5 GB of free disk space**
- **Internet connection** for downloading software and dependencies

### What You Don't Need
- You don't need to know how to code
- You don't need prior experience with Python or machine learning
- You don't need to understand how the AI works (but you can learn if you want!)

---

## Step 1: Install Conda

Conda is a package manager that helps organize Python and its libraries. Think of it as an app store for Python tools.

### What is Conda?

Conda creates isolated "environments" for different projects, so they don't interfere with each other. We'll use it to install Python and all the tools SHARP needs.

### Download and Install Miniconda

1. **Go to the Miniconda download page:**
   - Open your web browser and visit: https://docs.conda.io/en/latest/miniconda.html

2. **Download the macOS installer:**
   - Look for the **macOS** section
   - Download the **latest Python 3.x** installer for your Mac:
     - If you have an **M1/M2/M3 Mac** (Apple Silicon): Choose the `Apple M1` or `arm64` version
     - If you have an **Intel Mac**: Choose the `Intel x86_64` version
   - The file will be named something like `Miniconda3-latest-MacOSX-arm64.pkg` or `Miniconda3-latest-MacOSX-x86_64.pkg`

3. **Install Miniconda:**
   - Double-click the downloaded `.pkg` file
   - Follow the installation wizard:
     - Click "Continue" through the introduction screens
     - Accept the license agreement
     - Choose "Install for me only" (recommended)
     - Click "Install" and enter your password when prompted
   - When installation completes, click "Close"

4. **Verify the installation:**
   - Open **Terminal** (you can find it in Applications → Utilities → Terminal)
   - Type the following command and press Enter:
     ```bash
     conda --version
     ```
   - You should see something like `conda X.X.X` (the exact version number may vary)
   - **If you get an error** saying "conda: command not found":
     - Close Terminal completely and open it again
     - Try the command again
     - If it still doesn't work, see [Troubleshooting](#troubleshooting)

---

## Step 2: Download the Project

Now we need to download the SHARP project files to your computer.

### Option A: Download via GitHub (Easiest for Beginners)

1. **Go to the GitHub repository:**
   - Visit the repository URL where this project is hosted (check the address bar or the project README for the correct URL)

2. **Download the ZIP file:**
   - Click the green **"Code"** button
   - Click **"Download ZIP"**
   - The file will be saved to your Downloads folder

3. **Extract the ZIP file:**
   - Go to your Downloads folder
   - Double-click the `ml-sharp-main.zip` (or similar name) file
   - macOS will automatically extract the folder

4. **Move to a convenient location (optional but recommended):**
   - Create a folder in your Documents called `Projects`
   - Drag the extracted `ml-sharp-main` folder into `Projects`
   - Rename it to just `ml-sharp` to make it simpler

### Option B: Using Git (If You Have It Installed)

If you're comfortable with Git or have it installed:

```bash
cd ~/Documents
git clone <repository-url>
cd ml-sharp
```

(Replace `<repository-url>` with the actual Git URL from the GitHub repository)

---

## Step 3: Set Up the Project

Now we'll set up the Python environment and install all the required libraries.

### Using Terminal

1. **Open Terminal** (Applications → Utilities → Terminal)

2. **Navigate to the project folder:**
   - Type `cd` followed by a space
   - Drag the `ml-sharp` folder from Finder onto the Terminal window
   - Press Enter
   - Your command should look something like: `cd /Users/YourName/Documents/Projects/ml-sharp`

3. **Initialize conda in your terminal:**
   ```bash
   conda init bash
   ```
   - Close Terminal and open it again

4. **Create the Python environment:**
   ```bash
   conda create -n sharp python=3.13 -y
   ```
   - This creates a special environment named "sharp" with Python 3.13
   - The process may take a few minutes
   - Wait for it to complete

5. **Activate the environment:**
   ```bash
   conda activate sharp
   ```
   - You should see `(sharp)` appear at the beginning of your command prompt

6. **Install the main project dependencies:**
   ```bash
   pip install -r requirements.txt
   ```
   - This installs all the machine learning libraries SHARP needs
   - **This will take 5-15 minutes** depending on your internet speed
   - You'll see a lot of text scrolling by—this is normal
   - Be patient and let it finish

7. **Install the web interface dependencies:**
   ```bash
   pip install -r src/sharp/web/requirements.txt
   ```
   - This installs the web server components
   - This should be faster, taking about 1-2 minutes

8. **Verify the installation:**
   ```bash
   sharp --help
   ```
   - If successful, you'll see the SHARP help menu
   - This means everything is installed correctly!

---

## Step 4: Start the Web Interface

Now for the exciting part—starting the web interface!

### If start.command Works (Try This First)

1. **In Finder, navigate to the ml-sharp folder**

2. **Double-click the `start.command` file**

3. **If macOS blocks it with a security warning:**
   - Right-click (or Control-click) on `start.command`
   - Select **"Open"** from the menu
   - Click **"Open"** in the dialog that appears
   - macOS will remember your choice for this file
   
   OR
   
   - Go to **System Settings → Privacy & Security**
   - Scroll down to find a message about `start.command` being blocked
   - Click **"Open Anyway"**
   - Right-click on `start.command` again and choose **"Open"**

4. **A Terminal window will open** with the SHARP logo

5. **The script will automatically:**
   - Check your conda installation
   - Create or activate the environment
   - Install any missing dependencies
   - Start the web server

6. **When you see "Starting Sharp Web Interface":**
   - Open your web browser (Safari, Chrome, Firefox, etc.)
   - Go to: **http://localhost:8000**
   - You should see the SHARP web interface!

### If start.command Doesn't Work (Manual Method)

If the automatic script doesn't work, don't worry! Here's how to start it manually:

1. **Open Terminal**

2. **Navigate to the project folder:**
   ```bash
   cd /path/to/ml-sharp
   ```
   (Replace with your actual path, or drag the folder onto Terminal)

3. **Activate the conda environment:**
   ```bash
   conda activate sharp
   ```

4. **Start the web server:**
   ```bash
   python src/sharp/web/app.py
   ```

5. **Open your web browser and go to:**
   - **http://localhost:8000**

6. **To stop the server:**
   - Press **Control + C** in the Terminal window

---

## Troubleshooting

### "conda: command not found"

**Problem:** Terminal doesn't recognize the `conda` command.

**Solutions:**

1. **Initialize conda:**
   ```bash
   ~/miniconda3/bin/conda init bash
   ```
   Then close and reopen Terminal.

2. **Add conda to your PATH manually:**
   ```bash
   echo 'export PATH="$HOME/miniconda3/bin:$PATH"' >> ~/.bash_profile
   source ~/.bash_profile
   ```

3. **If you installed Anaconda instead of Miniconda:**
   ```bash
   echo 'export PATH="$HOME/anaconda3/bin:$PATH"' >> ~/.bash_profile
   source ~/.bash_profile
   ```

### "Permission denied" when running start.command

**Problem:** The script doesn't have permission to run.

**Solution:**

1. Open Terminal
2. Navigate to the project folder
3. Make the script executable:
   ```bash
   chmod +x start.command
   ```
4. Try double-clicking it again

### "Failed to create conda environment"

**Problem:** Error creating the Python environment.

**Solutions:**

1. **Make sure you have enough disk space** (at least 5 GB free)

2. **Update conda:**
   ```bash
   conda update conda
   ```

3. **Try creating the environment with a different Python version:**
   ```bash
   conda create -n sharp python=3.11 -y
   ```

### Installation is Taking Forever / Stuck

**Problem:** `pip install` seems frozen or very slow.

**Solutions:**

1. **Be patient:** The first installation can take 10-20 minutes, especially for PyTorch
2. **Check your internet connection**
3. **If truly stuck (no progress for 30+ minutes):**
   - Press Control + C to cancel
   - Try again:
     ```bash
     pip install -r requirements.txt --no-cache-dir
     ```

### "Port 8000 is already in use"

**Problem:** Another application is using port 8000.

**Solution:**

1. **Find and stop the process using port 8000:**
   ```bash
   lsof -ti:8000 | xargs kill -9
   ```

2. **Or modify the port in the app.py file:**
   - Open `src/sharp/web/app.py` in a text editor
   - Look for the line near the end: `uvicorn.run(app, host="0.0.0.0", port=8000)`
     (Tip: Search for `port=` to find it quickly)
   - Change `port=8000` to `port=8080` (or another available port number)
   - Save the file and start the server again
   - Then access it at: http://localhost:8080 (or your chosen port)

### The Web Interface Won't Load

**Problem:** Browser shows an error when accessing http://localhost:8000

**Solutions:**

1. **Make sure the server is actually running** (check Terminal for errors)
2. **Try a different browser**
3. **Clear your browser cache**
4. **Check if you're using the correct URL:** http://localhost:8000 (not https)
5. **Look for error messages in the Terminal** and search for them online or see below

### "ModuleNotFoundError: No module named 'sharp'"

**Problem:** Python can't find the SHARP module.

**Solution:**

1. Make sure you're in the correct directory
2. Make sure the conda environment is activated (you should see `(sharp)` in the prompt)
3. Try installing again:
   ```bash
   pip install -r requirements.txt
   ```

### Out of Memory Errors

**Problem:** Your computer runs out of RAM.

**Solutions:**

1. **Close other applications** to free up memory
2. **Restart your computer** and try again
3. **Consider using the CLI** instead of the web interface for large batches of images

---

## Alternative Setup Methods

### For Windows Users

The `start.command` script is macOS-specific, but you can follow these steps on Windows:

1. **Install Miniconda for Windows:**
   - Download from: https://docs.conda.io/en/latest/miniconda.html
   - Choose the Windows installer

2. **Open Anaconda Prompt** (search for it in the Start menu)

3. **Follow steps 3 and 4** from above, using the same commands

### For Linux Users

The setup is very similar to macOS:

1. **Install Miniconda for Linux:**
   ```bash
   wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
   bash Miniconda3-latest-Linux-x86_64.sh
   ```

2. **Follow the macOS instructions** using Terminal

### Using the Command Line Interface (CLI)

If you prefer not to use the web interface, you can use SHARP directly from the command line:

1. **Activate the environment:**
   ```bash
   conda activate sharp
   ```

2. **Run a prediction:**
   ```bash
   sharp predict -i /path/to/input/images -o /path/to/output/gaussians
   ```

3. **See all options:**
   ```bash
   sharp --help
   ```

---

## What's Next?

Once you have the web interface running:

1. **Upload an image** using the web interface
2. **Wait for processing** (usually takes a few seconds per image)
3. **Download the 3D Gaussian file** (.ply format)
4. **View it** using a 3D Gaussian viewer (the web interface may include a viewer)

For more advanced usage, check out the [README.md](README.md) file in the project folder.

---

## Getting Help

If you're still stuck after trying these solutions:

1. **Check the project's GitHub Issues page** to see if others have had similar problems
2. **Read the main [README.md](README.md)** for additional technical details
3. **Create a new GitHub Issue** describing your problem:
   - Include your operating system version
   - Include any error messages you see
   - Describe what you've already tried

---

## Tips for Success

- **Be patient:** The first setup takes time, but subsequent runs will be much faster
- **Read error messages:** They often tell you exactly what's wrong
- **Google is your friend:** Copy error messages and search for them
- **Keep your terminal open:** Don't close Terminal while the server is running
- **Save your work:** The web interface processes images but doesn't permanently store them

---

## Summary of Commands

Here's a quick reference of the key commands:

```bash
# Navigate to project
cd /path/to/ml-sharp

# Activate environment
conda activate sharp

# Start web interface (manual method)
python src/sharp/web/app.py

# Use CLI
sharp predict -i /path/to/images -o /path/to/output

# Deactivate environment when done
conda deactivate
```

---

**Congratulations!** 🎉 You now have SHARP set up and running. Enjoy creating 3D representations from your photos!