Update app.py
Browse files
app.py
CHANGED
@@ -101,30 +101,31 @@ def load_file(file_name):
|
|
101 |
#)
|
102 |
#st.markdown(result)
|
103 |
|
104 |
-
def search_arxiv():
|
105 |
st.title("โถ๏ธ Semantic and Episodic Memory System")
|
106 |
|
107 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
108 |
|
109 |
-
search_query =
|
110 |
top_n_results = st.slider("Top n results as context", min_value=4, max_value=100, value=100)
|
111 |
search_source = st.selectbox("Search Source", ["Semantic Search - up to 10 Mar 2024", "Arxiv Search - Latest - (EXPERIMENTAL)"])
|
112 |
llm_model = st.selectbox("LLM Model", ["mistralai/Mixtral-8x7B-Instruct-v0.1", "mistralai/Mistral-7B-Instruct-v0.2", "google/gemma-7b-it", "None"])
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
|
129 |
saved_files = [f for f in os.listdir(".") if f.endswith(".md")]
|
130 |
selected_file = st.sidebar.selectbox("Saved Files", saved_files)
|
@@ -145,8 +146,6 @@ def search_arxiv():
|
|
145 |
os.remove(selected_file)
|
146 |
st.warning(f"File deleted: {selected_file}")
|
147 |
|
148 |
-
|
149 |
-
|
150 |
# Set page configuration with a title and favicon
|
151 |
st.set_page_config(
|
152 |
page_title="๐๐Arxiv-Paper-Search-QA-RAG-Streamlit-Gradio-APAI",
|
|
|
101 |
#)
|
102 |
#st.markdown(result)
|
103 |
|
104 |
+
def search_arxiv(query):
|
105 |
st.title("โถ๏ธ Semantic and Episodic Memory System")
|
106 |
|
107 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
108 |
|
109 |
+
search_query = query
|
110 |
top_n_results = st.slider("Top n results as context", min_value=4, max_value=100, value=100)
|
111 |
search_source = st.selectbox("Search Source", ["Semantic Search - up to 10 Mar 2024", "Arxiv Search - Latest - (EXPERIMENTAL)"])
|
112 |
llm_model = st.selectbox("LLM Model", ["mistralai/Mixtral-8x7B-Instruct-v0.1", "mistralai/Mistral-7B-Instruct-v0.2", "google/gemma-7b-it", "None"])
|
113 |
|
114 |
+
st.markdown('### ๐ ' + query
|
115 |
+
#if st.button("๐ Search"):
|
116 |
+
result = client.predict(
|
117 |
+
search_query,
|
118 |
+
top_n_results,
|
119 |
+
search_source,
|
120 |
+
llm_model,
|
121 |
+
api_name="/update_with_rag_md"
|
122 |
+
)
|
123 |
+
st.markdown(result)
|
124 |
|
125 |
+
file_type = st.radio("Select Memory Flag", ("Semantic", "Episodic"))
|
126 |
+
if st.button("Save"):
|
127 |
+
file_name = save_file(result, file_type)
|
128 |
+
st.success(f"File saved: {file_name}")
|
129 |
|
130 |
saved_files = [f for f in os.listdir(".") if f.endswith(".md")]
|
131 |
selected_file = st.sidebar.selectbox("Saved Files", saved_files)
|
|
|
146 |
os.remove(selected_file)
|
147 |
st.warning(f"File deleted: {selected_file}")
|
148 |
|
|
|
|
|
149 |
# Set page configuration with a title and favicon
|
150 |
st.set_page_config(
|
151 |
page_title="๐๐Arxiv-Paper-Search-QA-RAG-Streamlit-Gradio-APAI",
|