Spaces:
Running
Running
Update utils.py
Browse files
utils.py
CHANGED
@@ -81,6 +81,13 @@ user_template = """<div class="alert alert-block alert-success">
|
|
81 |
</div>
|
82 |
"""
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
def create_base_notebook(messages):
|
85 |
base_notebook = {
|
86 |
"metadata": {
|
@@ -94,7 +101,11 @@ def create_base_notebook(messages):
|
|
94 |
"nbformat_minor": 0,
|
95 |
"cells": []
|
96 |
}
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
for message in messages:
|
99 |
if message["role"] == "system":
|
100 |
text = system_template.format(message["content"].replace('\n', '<br>'))
|
|
|
81 |
</div>
|
82 |
"""
|
83 |
|
84 |
+
header_message = """<p align="center">
|
85 |
+
<img src="https://huggingface.co/spaces/lvwerra/jupyter-agent/resolve/main/jupyter-agent.png" />
|
86 |
+
</p>
|
87 |
+
|
88 |
+
|
89 |
+
<p style="text-align:center;">Let a LLM agent write and execute code inside a notebook!</p>"""
|
90 |
+
|
91 |
def create_base_notebook(messages):
|
92 |
base_notebook = {
|
93 |
"metadata": {
|
|
|
101 |
"nbformat_minor": 0,
|
102 |
"cells": []
|
103 |
}
|
104 |
+
base_notebook["cells"].append({
|
105 |
+
"cell_type": "markdown",
|
106 |
+
"metadata": {},
|
107 |
+
"source": header_message
|
108 |
+
})
|
109 |
for message in messages:
|
110 |
if message["role"] == "system":
|
111 |
text = system_template.format(message["content"].replace('\n', '<br>'))
|