Code
instruction = "Your job: \
- Improve grammar and language \
- fix errors \
- cut the clutter \
- but keep tone and voice \
- don't change markdown syntax, \
- rephrase for easier reading \
- limit the use of emoji \
- never cut jokes \
- only return the corrected text, no summaries of changes or list of improvements"Code
for cell in tqdm(notebook["cells"]):
# print(cell["cell_type"])
if cell["cell_type"] == "markdown":
print("-" * 6)
print(cell["source"])
response = ollama.generate(
model="phi",
system=instruction,
prompt=" ".join(cell["source"]),
keep_alive="5m",
)
cell["source"].append("--- \n " + response["response"])