Spaces:
Sleeping
Sleeping
attempt to neaten code
Browse files
app.py
CHANGED
@@ -34,11 +34,18 @@ dotenv.load_dotenv()
|
|
34 |
|
35 |
|
36 |
text_splitter = CharacterTextSplitter(
|
37 |
-
chunk_size=350,
|
38 |
chunk_overlap=0
|
39 |
)
|
40 |
|
41 |
-
# flan_ul2 = HuggingFaceHub(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
# flan_ul2 = OpenAI()
|
43 |
from langchain.chat_models import ChatOpenAI
|
44 |
|
@@ -51,7 +58,6 @@ flan_ul2 = chat = ChatOpenAI(
|
|
51 |
|
52 |
global qa
|
53 |
|
54 |
-
|
55 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY")
|
56 |
embeddings = CohereEmbeddings(
|
57 |
model="embed-english-v3.0",
|
@@ -64,7 +70,6 @@ def loading_pdf():
|
|
64 |
return "Loading..."
|
65 |
def pdf_changes(pdf_doc):
|
66 |
|
67 |
-
|
68 |
embeddings = CohereEmbeddings(
|
69 |
model="embed-english-light-v3.0",
|
70 |
|
@@ -77,10 +82,9 @@ def pdf_changes(pdf_doc):
|
|
77 |
retriever = db.as_retriever()
|
78 |
|
79 |
memory = ConversationBufferMemory(
|
80 |
-
memory_key="chat_history",
|
81 |
input_key="human_input"
|
82 |
)
|
83 |
-
|
84 |
|
85 |
|
86 |
prompt = PromptTemplate(
|
|
|
34 |
|
35 |
|
36 |
text_splitter = CharacterTextSplitter(
|
37 |
+
chunk_size=350,
|
38 |
chunk_overlap=0
|
39 |
)
|
40 |
|
41 |
+
# flan_ul2 = HuggingFaceHub(
|
42 |
+
# repo_id="HuggingFaceH4/zephyr-7b-beta",
|
43 |
+
# model_kwargs={
|
44 |
+
# "temperature":0.1,
|
45 |
+
# "max_new_tokens":300
|
46 |
+
# }
|
47 |
+
# )
|
48 |
+
|
49 |
# flan_ul2 = OpenAI()
|
50 |
from langchain.chat_models import ChatOpenAI
|
51 |
|
|
|
58 |
|
59 |
global qa
|
60 |
|
|
|
61 |
COHERE_API_KEY = os.getenv("COHERE_API_KEY")
|
62 |
embeddings = CohereEmbeddings(
|
63 |
model="embed-english-v3.0",
|
|
|
70 |
return "Loading..."
|
71 |
def pdf_changes(pdf_doc):
|
72 |
|
|
|
73 |
embeddings = CohereEmbeddings(
|
74 |
model="embed-english-light-v3.0",
|
75 |
|
|
|
82 |
retriever = db.as_retriever()
|
83 |
|
84 |
memory = ConversationBufferMemory(
|
85 |
+
memory_key="chat_history",
|
86 |
input_key="human_input"
|
87 |
)
|
|
|
88 |
|
89 |
|
90 |
prompt = PromptTemplate(
|