Update app.py
Browse files
app.py
CHANGED
@@ -83,7 +83,20 @@ def SpeechSynthesis(result):
|
|
83 |
'''
|
84 |
components.html(documentHTML5, width=1280, height=300)
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
|
|
|
|
87 |
def search_arxiv(query):
|
88 |
|
89 |
# Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
|
@@ -97,6 +110,7 @@ def search_arxiv(query):
|
|
97 |
#llm_model = st.sidebar.selectbox(key='llmmodel', label="LLM Model", ["mistralai/Mixtral-8x7B-Instruct-v0.1", "mistralai/Mistral-7B-Instruct-v0.2", "google/gemma-7b-it", "None"])
|
98 |
llm_model = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
99 |
|
|
|
100 |
st.sidebar.markdown('### π ' + query)
|
101 |
result = client.predict(
|
102 |
search_query,
|
@@ -105,7 +119,7 @@ def search_arxiv(query):
|
|
105 |
llm_model,
|
106 |
api_name="/update_with_rag_md"
|
107 |
)
|
108 |
-
|
109 |
st.markdown(result)
|
110 |
arxiv_results = st.text_area("ArXiv Results: ", value=result, height=700)
|
111 |
result = str(result) # cast as string for these - check content length and format if encoding changes..
|
@@ -114,6 +128,7 @@ def search_arxiv(query):
|
|
114 |
filename=generate_filename(result, "md")
|
115 |
create_file(filename, query, result, should_save)
|
116 |
|
|
|
117 |
#file_type = st.radio("Select Which Type of Memory You Prefer:", ("Semantic", "Episodic"))
|
118 |
#if st.button("Save"):
|
119 |
# file_name = save_file(result, file_type)
|
|
|
83 |
'''
|
84 |
components.html(documentHTML5, width=1280, height=300)
|
85 |
|
86 |
+
def parse_to_markdown(text):
|
87 |
+
# Split text into fields by | character
|
88 |
+
fields = text.split("|")
|
89 |
+
|
90 |
+
markdown = ""
|
91 |
+
for field in fields:
|
92 |
+
# Remove leading/trailing quotes and whitespace
|
93 |
+
field = field.strip(" '")
|
94 |
+
|
95 |
+
# Add field to markdown with whitespace separator
|
96 |
+
markdown += field + "\n\n"
|
97 |
|
98 |
+
return markdown
|
99 |
+
|
100 |
def search_arxiv(query):
|
101 |
|
102 |
# Show ArXiv Scholary Articles! ----------------*************-------------***************----------------------------------------
|
|
|
110 |
#llm_model = st.sidebar.selectbox(key='llmmodel', label="LLM Model", ["mistralai/Mixtral-8x7B-Instruct-v0.1", "mistralai/Mistral-7B-Instruct-v0.2", "google/gemma-7b-it", "None"])
|
111 |
llm_model = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
112 |
|
113 |
+
|
114 |
st.sidebar.markdown('### π ' + query)
|
115 |
result = client.predict(
|
116 |
search_query,
|
|
|
119 |
llm_model,
|
120 |
api_name="/update_with_rag_md"
|
121 |
)
|
122 |
+
result = parse_to_markdown(result)
|
123 |
st.markdown(result)
|
124 |
arxiv_results = st.text_area("ArXiv Results: ", value=result, height=700)
|
125 |
result = str(result) # cast as string for these - check content length and format if encoding changes..
|
|
|
128 |
filename=generate_filename(result, "md")
|
129 |
create_file(filename, query, result, should_save)
|
130 |
|
131 |
+
|
132 |
#file_type = st.radio("Select Which Type of Memory You Prefer:", ("Semantic", "Episodic"))
|
133 |
#if st.button("Save"):
|
134 |
# file_name = save_file(result, file_type)
|