about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins2026-04-05 17:59:29 +0200
committerPjotr Prins2026-04-05 17:59:29 +0200
commitbbeb25ba4c25151f841f937bfbe0c4c0cd77f8c4 (patch)
treeb40f61e265560f22a392f2b64cc2521fc93dab77
parent59de73d7b09f2f398d8e043ffcb8b586e1d50bc5 (diff)
downloadgenecup-bbeb25ba4c25151f841f937bfbe0c4c0cd77f8c4.tar.gz
Use template to show intermediate phase
-rwxr-xr-xserver.py12
-rw-r--r--templates/call-gemini.html11
2 files changed, 14 insertions, 9 deletions
diff --git a/server.py b/server.py
index eea6487..9ce2786 100755
--- a/server.py
+++ b/server.py
@@ -1516,15 +1516,9 @@ def sentences():
             # Show loading page if not cached and not yet asked to classify
             if batch_cache_key not in _gemini_cache and not request.args.get('classify'):
                 loading_url = request.url + ('&' if '?' in request.url else '?') + 'classify=1'
-                return f'''<!doctype html>
-<html><head>
-<meta http-equiv="refresh" content="1; url={loading_url}">
-<style>body {{ font-family: sans-serif; text-align: center; margin-top: 100px; }}</style>
-</head><body>
-<h2>Calling Gemini API...</h2>
-<p>Classifying {len(all_stress_sentences)} sentences as cellular/organismal stress.</p>
-<p>Please wait, this page will refresh automatically.</p>
-</body></html>'''
+                return render_template('call-gemini.html',
+                                       url=loading_url,
+                                       count=len(all_stress_sentences))
 
             try:
                 batched_prompt = f"""For each sentence below, classify it as describing "Cellular Stress" or "Organismal Stress".
diff --git a/templates/call-gemini.html b/templates/call-gemini.html
new file mode 100644
index 0000000..29a50d8
--- /dev/null
+++ b/templates/call-gemini.html
@@ -0,0 +1,11 @@
+{% extends "layout.html" %}
+{% block content %}
+
+<meta http-equiv="refresh" content="1; url={{ url }}">
+
+<br>
+<h3>Calling Gemini API...</h3>
+<p>Classifying {{ count }} sentences as cellular/organismal stress.</p>
+<p>Please wait, this page will refresh automatically.</p>
+
+{% endblock %}