NavyDevilDoc commited on
Commit
bd85152
·
verified ·
1 Parent(s): 8fda2b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -23
app.py CHANGED
@@ -250,26 +250,29 @@ if query:
250
  # RETRIEVE THE ABSTRACT FROM DB
251
  doc_abstract = st.session_state.db.get_doc_abstract(res['doc_id'])
252
 
253
- st.markdown(f"""
254
- <div style="
255
- border-left: 5px solid {color};
256
- padding: 15px;
257
- background-color: #f0f2f6;
258
- margin-bottom: 15px;
259
- border-radius: 5px;
260
- color: #1f1f1f;
261
- ">
262
- <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
263
- <h4 style="margin:0; color: #0e1117;">📄 {res['source']}</h4>
264
- <span style="font-size: 0.8em; color: #555; background: #ddd; padding: 2px 8px; border-radius: 4px;">Relevance: {score:.2f}</span>
265
- </div>
266
-
267
- <div style="background: #e3e6ea; padding: 10px; border-radius: 5px; margin-bottom: 10px;">
268
- <p style="margin: 0; font-size: 0.9em; color: #333;"><strong>🤖 Abstract:</strong> {doc_abstract}</p>
269
- </div>
270
-
271
- <p style="margin: 0; font-style: italic; font-size: 0.85em; color: #555;">
272
- "Matching Chunk: ...{res['snippet']}..."
273
- </p>
274
- </div>
275
- """, unsafe_allow_html=True)
 
 
 
 
250
  # RETRIEVE THE ABSTRACT FROM DB
251
  doc_abstract = st.session_state.db.get_doc_abstract(res['doc_id'])
252
 
253
+ # FIX: We moved the HTML string flush to the left to prevent
254
+ # Markdown from interpreting it as a code block.
255
+ html_content = f"""
256
+ <div style="
257
+ border-left: 5px solid {color};
258
+ padding: 15px;
259
+ background-color: #f0f2f6;
260
+ margin-bottom: 15px;
261
+ border-radius: 5px;
262
+ color: #1f1f1f;
263
+ ">
264
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
265
+ <h4 style="margin:0; color: #0e1117;">📄 {res['source']}</h4>
266
+ <span style="font-size: 0.8em; color: #555; background: #ddd; padding: 2px 8px; border-radius: 4px;">Relevance: {score:.2f}</span>
267
+ </div>
268
+
269
+ <div style="background: #e3e6ea; padding: 10px; border-radius: 5px; margin-bottom: 10px;">
270
+ <p style="margin: 0; font-size: 0.9em; color: #333;"><strong>🤖 Abstract:</strong> {doc_abstract}</p>
271
+ </div>
272
+
273
+ <p style="margin: 0; font-style: italic; font-size: 0.85em; color: #555;">
274
+ "Matching Chunk: ...{res['snippet']}..."
275
+ </p>
276
+ </div>
277
+ """
278
+ st.markdown(html_content, unsafe_allow_html=True)