File size: 2,373 Bytes
c8016f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 06 - Deploying Updates

This guide explains how to get local changes onto GitHub and Hugging Face.

## Recommended Workflow

Use GitHub as the shared source of truth and Hugging Face as the live app host.

The usual flow is:

```text
local computer -> GitHub -> Hugging Face
```

## Before Deploying

Run:

```bash
git status
git diff --stat
python3 -m py_compile app/app.py
```

If you changed case-study data, also run:

```bash
python3 ingest/create_summary_chunks.py
python3 ingest/embed_and_index.py
```

If you changed the app, test locally:

```bash
streamlit run app/app.py
```

## Commit the Right Files

For website text/code changes:

```bash
git add app/app.py
git commit -m "Update website"
```

For a new case study:

```bash
git add data/extracted/CS124.json
git add data/extracted/case_summaries.json
git add data/extracted/precomputed_embeddings.json
git add data/raw/CS124/case_meta.json
git add case_study_pipeline/drive_folders.json
git add ingest/source_link_overrides.json
git commit -m "Add CS124 case study"
```

Do not add raw PDFs unless the team explicitly decides to store PDFs in GitHub.

## Push to GitHub

```bash
git push shared-github HEAD:main
```

If working on a branch:

```bash
git push origin your-branch-name
```

Then open a pull request into `main`.

## Push to Hugging Face

Manual push:

```bash
git push uwrfr-chatbot HEAD:main
```

Check status:

```bash
hf spaces info UWRFR/UWaterlooRFRChatBot
```

The Hugging Face Space may take a minute to rebuild.

## GitHub Action Deployment

The repo has a GitHub Action:

```text
.github/workflows/deploy-hf-space.yml
```

It can upload the repo to a Hugging Face Space.

For it to work, GitHub needs:

Secret:

```text
HF_TOKEN
```

Variable or workflow input:

```text
HF_SPACE_ID
```

For this project, the target Space is:

```text
UWRFR/UWaterlooRFRChatBot
```

## Files Excluded from Hugging Face Upload

The deployment excludes files such as:

```text
.git/
.github/
venv/
__pycache__/
data/raw/
*.pdf
```

That means raw source PDFs usually stay in Google Drive, while processed JSON
and embeddings are deployed to the website.

## After Deploying

Open:

```text
https://uwrfr-uwaterloorfrchatbot.hf.space
```

Check:

- The website loads.
- The navigation works.
- New case studies appear.
- Source links appear.
- A test question works.
- Previous Responses still work.