Spaces:
Sleeping
Sleeping
Commit
·
d8570a8
1
Parent(s):
a452272
feat: choose llms model
Browse files- app.py +3 -3
- pages/chat.py +1 -1
- pages/upload_file.py +5 -4
- pages/upload_url.py +9 -9
app.py
CHANGED
@@ -22,8 +22,8 @@ def initialize_models():
|
|
22 |
return processing, drake
|
23 |
|
24 |
|
25 |
-
def disable_sidebar():
|
26 |
-
st.set_page_config(page_title=
|
27 |
page_icon=None,
|
28 |
layout="centered",
|
29 |
initial_sidebar_state="collapsed",
|
@@ -37,7 +37,7 @@ def disable_sidebar():
|
|
37 |
|
38 |
|
39 |
def main():
|
40 |
-
disable_sidebar()
|
41 |
initialize_models()
|
42 |
st.switch_page(initial_page)
|
43 |
|
|
|
22 |
return processing, drake
|
23 |
|
24 |
|
25 |
+
def disable_sidebar(page_title: str):
|
26 |
+
st.set_page_config(page_title=page_title,
|
27 |
page_icon=None,
|
28 |
layout="centered",
|
29 |
initial_sidebar_state="collapsed",
|
|
|
37 |
|
38 |
|
39 |
def main():
|
40 |
+
disable_sidebar("Drake")
|
41 |
initialize_models()
|
42 |
st.switch_page(initial_page)
|
43 |
|
pages/chat.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
from app import disable_sidebar, initialize_models
|
3 |
|
4 |
-
disable_sidebar()
|
5 |
col1, col2= st.columns([3, 1.6])
|
6 |
|
7 |
if "messages" not in st.session_state:
|
|
|
1 |
import streamlit as st
|
2 |
from app import disable_sidebar, initialize_models
|
3 |
|
4 |
+
disable_sidebar("Drake | Chat")
|
5 |
col1, col2= st.columns([3, 1.6])
|
6 |
|
7 |
if "messages" not in st.session_state:
|
pages/upload_file.py
CHANGED
@@ -2,10 +2,10 @@ import streamlit as st
|
|
2 |
import io
|
3 |
import PyPDF2
|
4 |
from app import disable_sidebar, initialize_models
|
5 |
-
from model import DrakeLM
|
6 |
-
from utilis import Processing
|
7 |
|
8 |
-
|
|
|
|
|
9 |
st.title('Drake')
|
10 |
st.subheader('Learn without the mess of making notes!')
|
11 |
st.divider()
|
@@ -16,6 +16,8 @@ if st.button("Youtube/Video URL"):
|
|
16 |
st.subheader('Upload the file')
|
17 |
uploaded_file = st.file_uploader(label="Choose a file", type=['pdf', 'doc'])
|
18 |
allow_make_notes = st.toggle('Make Complete Notes!')
|
|
|
|
|
19 |
|
20 |
|
21 |
if uploaded_file:
|
@@ -31,7 +33,6 @@ if uploaded_file:
|
|
31 |
for page in pdf_reader.pages:
|
32 |
text += page.extract_text()
|
33 |
|
34 |
-
processing, drake = initialize_models()
|
35 |
documents, metadata = processing.load_pdf("hello world", text)
|
36 |
st.session_state["metadata"] = metadata
|
37 |
st.success("Successfully chunked the file")
|
|
|
2 |
import io
|
3 |
import PyPDF2
|
4 |
from app import disable_sidebar, initialize_models
|
|
|
|
|
5 |
|
6 |
+
|
7 |
+
disable_sidebar("Drake | Upload File")
|
8 |
+
processing, drake = initialize_models()
|
9 |
st.title('Drake')
|
10 |
st.subheader('Learn without the mess of making notes!')
|
11 |
st.divider()
|
|
|
16 |
st.subheader('Upload the file')
|
17 |
uploaded_file = st.file_uploader(label="Choose a file", type=['pdf', 'doc'])
|
18 |
allow_make_notes = st.toggle('Make Complete Notes!')
|
19 |
+
llm_model = st.selectbox('Choose LLM Model', ('gemini-pro', 'llama', 'Mobile phone'))
|
20 |
+
drake.llm_model = llm_model
|
21 |
|
22 |
|
23 |
if uploaded_file:
|
|
|
33 |
for page in pdf_reader.pages:
|
34 |
text += page.extract_text()
|
35 |
|
|
|
36 |
documents, metadata = processing.load_pdf("hello world", text)
|
37 |
st.session_state["metadata"] = metadata
|
38 |
st.success("Successfully chunked the file")
|
pages/upload_url.py
CHANGED
@@ -1,11 +1,8 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
from app import disable_sidebar, initialize_models
|
4 |
-
from model import DrakeLM
|
5 |
-
from utilis import Processing
|
6 |
|
7 |
# Upload Template
|
8 |
-
disable_sidebar()
|
9 |
processing, drake = initialize_models()
|
10 |
st.title('Drake')
|
11 |
st.subheader('Learn without the mess of making notes!')
|
@@ -16,6 +13,9 @@ if st.button("PDF/Transcript"):
|
|
16 |
|
17 |
st.subheader('Enter the Video URL')
|
18 |
video_url = st.text_input(label="Enter the URL")
|
|
|
|
|
|
|
19 |
allow_make_notes = st.toggle('Make Complete Notes!')
|
20 |
|
21 |
|
@@ -34,11 +34,11 @@ if video_url:
|
|
34 |
st.error("Error in chunking")
|
35 |
|
36 |
# Uploading to DB
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
# Generating Notes
|
44 |
if allow_make_notes:
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from app import disable_sidebar, initialize_models
|
|
|
|
|
3 |
|
4 |
# Upload Template
|
5 |
+
disable_sidebar("Drake | Upload URL")
|
6 |
processing, drake = initialize_models()
|
7 |
st.title('Drake')
|
8 |
st.subheader('Learn without the mess of making notes!')
|
|
|
13 |
|
14 |
st.subheader('Enter the Video URL')
|
15 |
video_url = st.text_input(label="Enter the URL")
|
16 |
+
llm_model = st.selectbox('Choose LLM Model', ('gemini-pro', 'llama', 'Mobile phone'))
|
17 |
+
drake.llm_model = llm_model
|
18 |
+
|
19 |
allow_make_notes = st.toggle('Make Complete Notes!')
|
20 |
|
21 |
|
|
|
34 |
st.error("Error in chunking")
|
35 |
|
36 |
# Uploading to DB
|
37 |
+
with st.spinner('Please wait, documents uploading ...'):
|
38 |
+
try:
|
39 |
+
processing.upload_to_db(documents)
|
40 |
+
except Exception as e:
|
41 |
+
st.error("Error in uploading")
|
42 |
|
43 |
# Generating Notes
|
44 |
if allow_make_notes:
|