internationalscholarsprogram commited on
Commit
cd692da
·
verified ·
1 Parent(s): ef625a9

Skip campus images in handbook generation for reliability

Browse files
Files changed (1) hide show
  1. app/services/html_builder.py +3 -10
app/services/html_builder.py CHANGED
@@ -164,23 +164,16 @@ def _prepare_university_data(
164
  sec_map[k] = s
165
 
166
  # Campus image
 
 
167
  img_section = sec_map.get("campus_image") or sec_map.get("image")
168
  campus_image = ""
169
  campus_caption = ""
170
  if img_section:
171
  j = img_section.get("section_json", {})
172
  if isinstance(j, dict):
173
- campus_url = str(j.get("image_url", "")).strip()
174
  campus_caption = str(j.get("caption", "")).strip()
175
- if allow_remote and campus_url:
176
- embedded = fetch_image_data_uri(campus_url)
177
- if embedded:
178
- campus_image = embedded
179
- stats["images_embedded"] = stats.get("images_embedded", 0) + 1
180
- else:
181
- stats["images_placeholder"] = stats.get("images_placeholder", 0) + 1
182
- else:
183
- stats["images_placeholder"] = stats.get("images_placeholder", 0) + 1
184
 
185
  # Overview and website
186
  resolved_website = (uni_raw.get("website") or "").strip()
 
164
  sec_map[k] = s
165
 
166
  # Campus image
167
+ # Disable university campus-image embedding in the generation path.
168
+ # Large per-school images were the main source of handbook timeouts in Space.
169
  img_section = sec_map.get("campus_image") or sec_map.get("image")
170
  campus_image = ""
171
  campus_caption = ""
172
  if img_section:
173
  j = img_section.get("section_json", {})
174
  if isinstance(j, dict):
 
175
  campus_caption = str(j.get("caption", "")).strip()
176
+ stats["images_placeholder"] = stats.get("images_placeholder", 0) + 1
 
 
 
 
 
 
 
 
177
 
178
  # Overview and website
179
  resolved_website = (uni_raw.get("website") or "").strip()