Spaces:
Sleeping
Sleeping
Update component/notebook_view.py
Browse files- component/notebook_view.py +17 -0
component/notebook_view.py
CHANGED
|
@@ -1 +1,18 @@
|
|
| 1 |
# Notebook view component
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Notebook view component
|
| 2 |
+
# File: components/notebook_view.py
|
| 3 |
+
import streamlit as st
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def render_notebook(cells):
|
| 7 |
+
"""
|
| 8 |
+
Render a sequence of code cells as a live notebook view.
|
| 9 |
+
Args:
|
| 10 |
+
cells (List[str]): Each string is a code cell to display.
|
| 11 |
+
"""
|
| 12 |
+
st.header("📓 Reproducible Notebook")
|
| 13 |
+
if not cells:
|
| 14 |
+
st.info("No notebook cells available for this paper.")
|
| 15 |
+
return
|
| 16 |
+
for idx, cell in enumerate(cells, 1):
|
| 17 |
+
st.subheader(f"Cell {idx}")
|
| 18 |
+
st.code(cell, language='python')
|