Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode
.ipynb_checkpoints
content
.env
__pycache__
10 changes: 8 additions & 2 deletions gpt_author_v2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@
"\n",
" print(f'Output for prompt \"{prompt}\" has been written to {file_path}\\n')\n",
"\n",
"import re\n",
"\n",
"def escape_double_quotes(input_string):\n",
" # Update double quotes with escaped double quote mark to fix chapter_titles format error\n",
" cleaned_string = re.sub(r'\"', \"\\\"\", input_string)\n",
" return cleaned_string\n",
"\n",
"def write_fantasy_novel(prompt, num_chapters, writing_style, claude_true=False):\n",
" plots = generate_plots(prompt)\n",
Expand All @@ -469,7 +475,7 @@
"\n",
" storyline = generate_storyline(improved_plot, num_chapters)\n",
" print('storyline generated')\n",
" chapter_titles = ast.literal_eval(storyline)\n",
" chapter_titles = ast.literal_eval(escape_double_quotes(str(storyline)))\n",
"\n",
"\n",
" novel = f\"Storyline:\\n{storyline}\\n\\n\"\n",
Expand Down Expand Up @@ -539,4 +545,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}