Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import streamlit as st
|
2 |
-
from config.globals import SPEAKER_TYPES, initial_prompt
|
3 |
from langchain.prompts import PromptTemplate
|
4 |
from langchain.chains.question_answering import load_qa_chain
|
5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
@@ -14,6 +13,20 @@ from langchain.embeddings import SentenceTransformerEmbeddings
|
|
14 |
from langchain_core.output_parsers import StrOutputParser
|
15 |
from langchain_core.runnables import RunnablePassthrough
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
# --- Your RAG chatbot logic ---
|
18 |
source_data_folder = "MyData"
|
19 |
text_splitter = RecursiveCharacterTextSplitter(
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from langchain.prompts import PromptTemplate
|
3 |
from langchain.chains.question_answering import load_qa_chain
|
4 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
13 |
from langchain_core.output_parsers import StrOutputParser
|
14 |
from langchain_core.runnables import RunnablePassthrough
|
15 |
|
16 |
+
|
17 |
+
# Define SPEAKER_TYPES to distinguish between user and bot roles
|
18 |
+
SPEAKER_TYPES = {
|
19 |
+
"USER": "user",
|
20 |
+
"BOT": "bot"
|
21 |
+
}
|
22 |
+
|
23 |
+
# Define the initial prompt to show when the app starts
|
24 |
+
initial_prompt = {
|
25 |
+
'role': SPEAKER_TYPES["BOT"],
|
26 |
+
'content': "Hello! I am your Gemini Pro RAG chatbot. You can ask me questions after uploading a PDF."
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
# --- Your RAG chatbot logic ---
|
31 |
source_data_folder = "MyData"
|
32 |
text_splitter = RecursiveCharacterTextSplitter(
|