zakerytclarke commited on
Commit
0f3b8dd
·
verified ·
1 Parent(s): 1066a1b

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +34 -22
src/streamlit_app.py CHANGED
@@ -77,7 +77,7 @@ with col1:
77
  st.image(LOGO_URL, width=56) # fixed width prevents "flash huge"
78
  with col2:
79
  st.markdown("## TeapotAI Chat")
80
- st.caption("Grounded answers with web context")
81
 
82
 
83
  # =========================
@@ -89,7 +89,7 @@ with st.sidebar:
89
  system_prompt = st.text_area(
90
  "System prompt",
91
  value=(
92
- "You are Teapot, an open-source AI assistant optimized for low-end devices, "
93
  "providing short, accurate responses without hallucinating while excelling at "
94
  "information extraction and text summarization. "
95
  "If the context does not answer the question, reply exactly: "
@@ -238,38 +238,50 @@ for i, msg in enumerate(st.session_state.messages):
238
  continue
239
 
240
  # Assistant
241
- st.markdown(msg["content"])
242
 
243
  # Info icon popover with full prompt/context
244
  # (st.popover is stable in your Streamlit range; no rerun on open/close)
245
  c1, c2 = st.columns([1, 12], vertical_alignment="center")
246
  with c1:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  with st.popover("ℹ️", help="Inspect"):
248
  st.markdown("**Context**")
249
  st.code(msg.get("context", ""), language="text")
250
- st.markdown("**System**")
251
  st.code(msg.get("system_prompt", ""), language="text")
252
  st.markdown("**Question**")
253
  st.code(msg.get("question", ""), language="text")
254
- st.markdown("**Prompt**")
255
- st.code(msg.get("prompt", ""), language="text")
256
- with c2:
257
- st.caption(
258
- f"🔎 {msg['search_time']:.2f}s "
259
- f"🧠 {msg['gen_time']:.2f}s "
260
- f"⚡ {msg['tps']:.1f} tok/s "
261
- f"🧾 in {msg['input_tokens']} • out {msg['output_tokens']}"
262
- )
263
 
264
- key = f"fb_{i}"
265
- st.session_state.setdefault(key, msg.get("feedback"))
266
- st.feedback(
267
- "thumbs",
268
- key=key,
269
- disabled=msg.get("feedback") is not None,
270
- on_change=handle_feedback,
271
- args=(i,),
272
- )
273
 
274
 
275
  # =========================
 
77
  st.image(LOGO_URL, width=56) # fixed width prevents "flash huge"
78
  with col2:
79
  st.markdown("## TeapotAI Chat")
80
+ st.caption("Teapot is a 77 million parameter LLM designed to generate ")
81
 
82
 
83
  # =========================
 
89
  system_prompt = st.text_area(
90
  "System prompt",
91
  value=(
92
+ "You are Teapot, an open-source AI assistant optimized for running on low-end cpu devices, "
93
  "providing short, accurate responses without hallucinating while excelling at "
94
  "information extraction and text summarization. "
95
  "If the context does not answer the question, reply exactly: "
 
238
  continue
239
 
240
  # Assistant
241
+
242
 
243
  # Info icon popover with full prompt/context
244
  # (st.popover is stable in your Streamlit range; no rerun on open/close)
245
  c1, c2 = st.columns([1, 12], vertical_alignment="center")
246
  with c1:
247
+ st.markdown(msg["content"])
248
+
249
+ with c2:
250
+
251
+ key = f"fb_{i}"
252
+ st.session_state.setdefault(key, msg.get("feedback"))
253
+ st.feedback(
254
+ "thumbs",
255
+ key=key,
256
+ disabled=msg.get("feedback") is not None,
257
+ on_change=handle_feedback,
258
+ args=(i,),
259
+ )
260
+
261
+
262
+
263
+ c3, c4 = st.columns([1, 12], vertical_alignment="center")
264
+ with c3:
265
+ st.caption(
266
+ f"🔎 {msg['search_time']:.2f}s (search)"
267
+ f"🧠 {msg['gen_time']:.2f}s (generation) "
268
+ f"⚡ {msg['tps']:.1f} tok/s "
269
+ f"🧾 {msg['input_tokens']} input tokens • {msg['output_tokens']} output tokens"
270
+ )
271
+
272
+ with c4:
273
  with st.popover("ℹ️", help="Inspect"):
274
  st.markdown("**Context**")
275
  st.code(msg.get("context", ""), language="text")
276
+ st.markdown("**System Prompt**")
277
  st.code(msg.get("system_prompt", ""), language="text")
278
  st.markdown("**Question**")
279
  st.code(msg.get("question", ""), language="text")
280
+
 
 
 
 
 
 
 
 
281
 
282
+
283
+
284
+
 
 
 
 
 
 
285
 
286
 
287
  # =========================