Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,18 +19,7 @@ st.set_page_config(
|
|
| 19 |
|
| 20 |
|
| 21 |
def main():
|
| 22 |
-
#
|
| 23 |
-
st.sidebar.title("SuoMoto.AI βοΈ")
|
| 24 |
-
st.sidebar.markdown(
|
| 25 |
-
"""
|
| 26 |
-
Streamline legal workflows with advanced AI-powered tools for document management, chat, and template generation.
|
| 27 |
-
"""
|
| 28 |
-
)
|
| 29 |
-
tab = st.sidebar.radio(
|
| 30 |
-
"Navigation",
|
| 31 |
-
["π Case Manager", "π Document Manager", "π€ Chat", "π Generate Templates"]
|
| 32 |
-
)
|
| 33 |
-
|
| 34 |
st.markdown(
|
| 35 |
"""
|
| 36 |
<style>
|
|
@@ -60,6 +49,18 @@ def main():
|
|
| 60 |
unsafe_allow_html=True
|
| 61 |
)
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
# Tab 1: Case Manager
|
| 64 |
if tab == "π Case Manager":
|
| 65 |
st.title("π Manage Cases")
|
|
@@ -154,4 +155,33 @@ def main():
|
|
| 154 |
with st.spinner("Generating response..."):
|
| 155 |
context = selected_document['text']
|
| 156 |
response = vector_store.chat_with_context(query, context)
|
| 157 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
def main():
|
| 22 |
+
# Header (placed at the start of the app)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
st.markdown(
|
| 24 |
"""
|
| 25 |
<style>
|
|
|
|
| 49 |
unsafe_allow_html=True
|
| 50 |
)
|
| 51 |
|
| 52 |
+
# Sidebar navigation
|
| 53 |
+
st.sidebar.title("SuoMoto.AI βοΈ")
|
| 54 |
+
st.sidebar.markdown(
|
| 55 |
+
"""
|
| 56 |
+
Streamline legal workflows with advanced AI-powered tools for document management, chat, and template generation.
|
| 57 |
+
"""
|
| 58 |
+
)
|
| 59 |
+
tab = st.sidebar.radio(
|
| 60 |
+
"Navigation",
|
| 61 |
+
["π Case Manager", "π Document Manager", "π€ Chat", "π Generate Templates"]
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
# Tab 1: Case Manager
|
| 65 |
if tab == "π Case Manager":
|
| 66 |
st.title("π Manage Cases")
|
|
|
|
| 155 |
with st.spinner("Generating response..."):
|
| 156 |
context = selected_document['text']
|
| 157 |
response = vector_store.chat_with_context(query, context)
|
| 158 |
+
st.markdown(f"**Response**: {response}")
|
| 159 |
+
|
| 160 |
+
# Allow adding new documents mid-chat
|
| 161 |
+
uploaded_file = st.file_uploader("π Upload Document During Chat", key="chat_upload")
|
| 162 |
+
if uploaded_file:
|
| 163 |
+
with st.spinner("Processing document..."):
|
| 164 |
+
text, chunks, metadata = doc_processor.process_and_tag_document(uploaded_file)
|
| 165 |
+
doc_data = {"title": uploaded_file.name, "text": text, "metadata": metadata}
|
| 166 |
+
case_manager.add_document(selected_case, doc_data)
|
| 167 |
+
st.success(f"Document '{uploaded_file.name}' added to case!")
|
| 168 |
+
|
| 169 |
+
# Tab 4: Generate Templates
|
| 170 |
+
elif tab == "π Generate Templates":
|
| 171 |
+
st.title("π Legal Document Templates")
|
| 172 |
+
st.markdown("Generate standard legal documents using predefined templates.")
|
| 173 |
+
render_template_generator()
|
| 174 |
+
|
| 175 |
+
# Footer
|
| 176 |
+
st.markdown(
|
| 177 |
+
"""
|
| 178 |
+
<div class="footer">
|
| 179 |
+
Synaptyx: SuoMoto.AI agent
|
| 180 |
+
</div>
|
| 181 |
+
""",
|
| 182 |
+
unsafe_allow_html=True
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
if __name__ == "__main__":
|
| 187 |
+
main()
|