awacke1 commited on
Commit
7dc9875
·
1 Parent(s): 8600b25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -285,8 +285,13 @@ def create_file(filename, prompt, response, should_save=True):
285
  has_python_code = False
286
  if ext in ['.txt', '.htm', '.md']:
287
  with open(f"{base_filename}.md", 'w') as file:
288
- content = prompt.strip() + '\r\n' + response
289
- file.write(content)
 
 
 
 
 
290
 
291
  if has_python_code:
292
  python_code = re.findall(r"```python([\s\S]*?)```", response)[0].strip()
 
285
  has_python_code = False
286
  if ext in ['.txt', '.htm', '.md']:
287
  with open(f"{base_filename}.md", 'w') as file:
288
+ try:
289
+ content = prompt.strip() + '\r\n' + response
290
+ file.write(content)
291
+ except:
292
+ st.write('Skipping write of file. Prompt and Response below.')
293
+ st.write(prompt)
294
+ st.write(response)
295
 
296
  if has_python_code:
297
  python_code = re.findall(r"```python([\s\S]*?)```", response)[0].strip()