Skip to content

Commit

Permalink
summarize working
Browse files Browse the repository at this point in the history
  • Loading branch information
RadCod3 committed Aug 30, 2023
1 parent b5ec0f0 commit 55231d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ def render_chat():
st.chat_message("assistant").write(output)


if st.session_state.summarize:
# print(st.session_state)
if "summarize" in st.session_state and st.session_state.summarize:
summary = get_summary(st.session_state.book["id"])
st.write(summary)
render_chat()
# render_chat()

if st.session_state.start_chatting:
if "start_chatting" in st.session_state and st.session_state.start_chatting:
render_chat()
10 changes: 9 additions & 1 deletion summarize.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import requests
import difflib
import os
from bs4 import BeautifulSoup
from dotenv import load_dotenv

load_dotenv()


# code to get summary from summarize model
def get_summary(book_id):
return f"{book_id} lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est laborum"
response = requests.get(os.getenv("SUMMARY_BACKEND") + f"get_summary/{book_id}")
if response.status_code == 200:
data = response.json()
return data["summary"]
return f"Error {response.status_code}"

0 comments on commit 55231d2

Please sign in to comment.