Spaces:
Sleeping
Sleeping
Create notebook_view.py
Browse files- components/notebook_view.py +18 -0
components/notebook_view.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File: components/notebook_view.py
|
| 2 |
+
import streamlit as st
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def render_notebook(cells):
|
| 6 |
+
"""
|
| 7 |
+
Render reproducible code cells with run buttons.
|
| 8 |
+
"""
|
| 9 |
+
st.header("📓 Reproducible Notebook")
|
| 10 |
+
if not cells:
|
| 11 |
+
st.info("No notebook cells available.")
|
| 12 |
+
return
|
| 13 |
+
for idx, cell in enumerate(cells, 1):
|
| 14 |
+
st.subheader(f"Cell {idx}")
|
| 15 |
+
st.code(cell, language='python')
|
| 16 |
+
if st.button(f"Run Cell {idx}", key=f"run_{idx}"):
|
| 17 |
+
# Placeholder: In practice this would execute via MCP
|
| 18 |
+
st.success(f"Executed cell {idx}")
|