awacke1 commited on
Commit
756ad34
·
1 Parent(s): 4117ac1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -281,7 +281,8 @@ def create_file(filename, prompt, response, should_save=True):
281
  if not should_save:
282
  return
283
  base_filename, ext = os.path.splitext(filename)
284
- has_python_code = bool(re.search(r"```python([\s\S]*?)```", response))
 
285
  if ext in ['.txt', '.htm', '.md']:
286
  with open(f"{base_filename}.md", 'w') as file:
287
  content = prompt.strip() + '\r\n' + response
@@ -289,10 +290,8 @@ def create_file(filename, prompt, response, should_save=True):
289
 
290
  if has_python_code:
291
  python_code = re.findall(r"```python([\s\S]*?)```", response)[0].strip()
292
- # one copy with runnable section - tee up with python process shell
293
  with open(f"{base_filename}-Code.py", 'w') as file:
294
  file.write(python_code)
295
- # second copy with markdown of prompt and response
296
  with open(f"{base_filename}.md", 'w') as file:
297
  content = prompt.strip() + '\r\n' + response
298
  file.write(content)
 
281
  if not should_save:
282
  return
283
  base_filename, ext = os.path.splitext(filename)
284
+ #has_python_code = bool(re.search(r"```python([\s\S]*?)```", response))
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
 
290
 
291
  if has_python_code:
292
  python_code = re.findall(r"```python([\s\S]*?)```", response)[0].strip()
 
293
  with open(f"{base_filename}-Code.py", 'w') as file:
294
  file.write(python_code)
 
295
  with open(f"{base_filename}.md", 'w') as file:
296
  content = prompt.strip() + '\r\n' + response
297
  file.write(content)