Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
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()
|