awacke1 commited on
Commit
1a1dc87
โ€ข
1 Parent(s): 9e8c5dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -112,10 +112,30 @@ def search_arxiv(query):
112
  )
113
 
114
  # Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
 
115
  arxiv_results = st.text_area("ArXiv Results: ", value=result, height=400)
116
- st.markdown(result.replace('\n', ' '))
117
  SpeechSynthesis(result) # Search History Reader / Writer IO Memory - Audio at Same time as Reading.
 
118
  filename=generate_filename(result, "md")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  create_file(filename, query, result, should_save)
120
  # Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
121
 
 
112
  )
113
 
114
  # Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
115
+ st.markdown(result)
116
  arxiv_results = st.text_area("ArXiv Results: ", value=result, height=400)
 
117
  SpeechSynthesis(result) # Search History Reader / Writer IO Memory - Audio at Same time as Reading.
118
+
119
  filename=generate_filename(result, "md")
120
+ base_filename, ext = os.path.splitext(filename)
121
+ with open(f"{base_filename}.md", 'w') as file:
122
+ try:
123
+ content = query.strip() + '\r\n' + result
124
+ file.write(content)
125
+ except:
126
+ st.write('.')
127
+
128
+ #has_python_code = re.search(r"```python([\s\S]*?)```", prompt.strip() + '\r\n' + response)
129
+ #has_python_code = bool(re.search(r"```python([\s\S]*?)```", prompt.strip() + '\r\n' + response))
130
+ #if has_python_code:
131
+ # python_code = re.findall(r"```python([\s\S]*?)```", response)[0].strip()
132
+ # with open(f"{base_filename}-Code.py", 'w') as file:
133
+ # file.write(python_code)
134
+ # with open(f"{base_filename}.md", 'w') as file:
135
+ # content = prompt.strip() + '\r\n' + response
136
+ # file.write(content)
137
+
138
+
139
  create_file(filename, query, result, should_save)
140
  # Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
141