File size: 1,909 Bytes
1eef0e0
a31f255
1eef0e0
 
 
 
 
a31f255
1eef0e0
 
 
 
6d4cc80
52d88a8
6d4cc80
52d88a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d4cc80
 
6445ea5
 
 
 
 
ca8be5b
 
6445ea5
ca8be5b
6d4cc80
 
 
 
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
---
title: Top Shelf
emoji: πŸš€
colorFrom: blue
colorTo: indigo
sdk: streamlit
sdk_version: 1.38.0
app_file: src/app.py
pinned: false
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

## Development Environment Setup

### Option 1: Conda Environment (Recommended)
```bash
# Create new conda environment with Python 3.11
conda create -n topshelf python=3.11

# Activate the environment
conda activate topshelf

# Install PyTorch first (CPU-only version)
conda install pytorch cpuonly -c pytorch

# Then install other requirements
pip install -r requirements-cpu.txt  # For CPU-only installation
# OR
pip install -r requirements.txt      # For full installation with GPU support
```

### Option 2: Python Virtual Environment
```bash
# Create virtual environment
python -m venv .venv
source .venv/bin/activate

# Install PyTorch first (CPU-only version)
pip install torch --index-url https://download.pytorch.org/whl/cpu

# Then install other requirements
pip install -r requirements-cpu.txt
```

## Update requirements.txt
There are two requirements.txt files, the requirements-cpu.txt can be used for smaller installations but will only use CPU based 
pytorch computations.

Keeping them in sync is important, *to do so on a CPU installed dev system* do the following:

1. Freeze requirements (get currently installed versions): ```pip freeze > requirements-cpu.txt```
1. Create a diff file with the changes needed to update requirements.txt: ```diff requirements-cpu.txt requirements.txt > req-patch.diff```
1. Edit the req-patch.diff to remove the torch* related diffs (the requirements.txt torch entries should not have +cpu)
1. Patch the requirements.txt file: ```patch -R requirements.txt req-patch.diff```

## Manual Testing
To run in google cloud shell: 
```streamlit run src/app.py --browser.serverAddress 8501-$WEB_HOST --browser.serverPort 80```