From 2d74b51a0da4b0f80760ab46abc25fca67e086be Mon Sep 17 00:00:00 2001 From: Pierre-Louis Biojout <78322686+Pierre-LouisBJT@users.noreply.github.com> Date: Thu, 2 May 2024 19:58:48 +0200 Subject: [PATCH] Implement Streamlit chat app interface --- README.md | 7 ++++++- requirements.txt | 1 + streamlit_app.py | 13 +++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 streamlit_app.py diff --git a/README.md b/README.md index 0ff1734..515482e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,11 @@ For a local demo in your terminal, type : $ python demo.py ``` +To run the Streamlit chat app, type: +``` +$ streamlit run streamlit_app.py +``` + ## To use it on another PDF file Put the PDF file in the `data/` folder. In `setup.py`, change the path to include the name of your file. @@ -39,4 +44,4 @@ The database will be saved in the `db/` folder. Langchain -Chroma \ No newline at end of file +Chroma diff --git a/requirements.txt b/requirements.txt index 0fa0763..265439f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -77,3 +77,4 @@ watchfiles==0.19.0 websockets==11.0.2 yarl==1.9.2 zstandard==0.21.0 +streamlit diff --git a/streamlit_app.py b/streamlit_app.py new file mode 100644 index 0000000..c7a8606 --- /dev/null +++ b/streamlit_app.py @@ -0,0 +1,13 @@ +import streamlit as st +import ask + +st.title('Xassistant Chat') + +st.sidebar.header('Instructions') +st.sidebar.write('Type your question about the Cycle Ingenieur of Ecole Polytechnique in the input box below and press enter to get an answer.') + +user_input = st.text_input("Question:", "") + +if user_input: + answer = ask.ask(user_input) + st.text_area("Answer:", value=answer, height=300, max_chars=None, help=None)