mgbam commited on
Commit
defde16
·
verified ·
1 Parent(s): 8fc9b1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -176,22 +176,30 @@ def render_ui():
176
  st.subheader("AI summary")
177
  st.info(res['ai_summary'])
178
 
179
- # --- Genes tab
180
  with tabs[1]:
181
  st.header("Gene / Variant signals")
182
- for g in res['genes']:
183
- # Skip non-dict entries (e.g., HTTP errors)
184
- if not isinstance(g, dict):
185
- continue
186
- sym = g.get('symbol') or g.get('name') or ''
187
- st.write(f"- **{sym}**")
188
- if res['mesh_defs']:
 
 
 
 
 
189
  st.markdown("### MeSH definitions")
190
- for d in res['mesh_defs']:
191
  st.write(f"- {d}")
192
- if res['gene_disease']:
 
 
 
193
  st.markdown("### DisGeNET links")
194
- st.json(res['gene_disease'][:15])
195
 
196
  # --- Trials tab
197
  with tabs[2]:
 
176
  st.subheader("AI summary")
177
  st.info(res['ai_summary'])
178
 
179
+ # --- Genes tab
180
  with tabs[1]:
181
  st.header("Gene / Variant signals")
182
+ # Filter out non-dict entries (e.g., errors)
183
+ valid_genes = [g for g in res['genes'] if isinstance(g, dict)]
184
+ if valid_genes:
185
+ for g in valid_genes:
186
+ sym = g.get('symbol') or g.get('name') or ''
187
+ st.write(f"- **{sym}**")
188
+ else:
189
+ st.info("No gene signals returned.")
190
+
191
+ # MeSH definitions (skip errors/non-strings)
192
+ mesh_list = [d for d in res['mesh_defs'] if isinstance(d, str) and d]
193
+ if mesh_list:
194
  st.markdown("### MeSH definitions")
195
+ for d in mesh_list:
196
  st.write(f"- {d}")
197
+
198
+ # DisGeNET links (skip non-dict entries)
199
+ gene_disease = [d for d in res['gene_disease'] if isinstance(d, dict)]
200
+ if gene_disease:
201
  st.markdown("### DisGeNET links")
202
+ st.json(gene_disease[:15])
203
 
204
  # --- Trials tab
205
  with tabs[2]: