Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -83,6 +83,12 @@ attachments_knowledge = load_knowledge("knowledge/bartholomew_attachments_defini
|
|
83 |
bigfive_knowledge = load_knowledge("knowledge/bigfive_definitions.txt")
|
84 |
personalities_knowledge = load_knowledge("knowledge/personalities_definitions.txt")
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
# Lazy initialization for retrieval chains
|
87 |
class LazyChains:
|
88 |
def __init__(self, lazy_llm):
|
@@ -95,9 +101,9 @@ class LazyChains:
|
|
95 |
def get_chains(self):
|
96 |
if self.attachments_chain is None:
|
97 |
llm = self.lazy_llm.get_llm()
|
98 |
-
self.attachments_chain = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=
|
99 |
-
self.bigfive_chain = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=
|
100 |
-
self.personalities_chain = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=
|
101 |
return self.attachments_chain, self.bigfive_chain, self.personalities_chain
|
102 |
|
103 |
lazy_chains = LazyChains(lazy_llm)
|
@@ -159,7 +165,7 @@ def process_video(video_file):
|
|
159 |
iface = gr.Interface(
|
160 |
fn=process_video,
|
161 |
inputs=gr.File(label="Upload Video File"),
|
162 |
-
outputs=gr.Textbox(label="
|
163 |
title="Video Analysis with Meta-Llama-3.1-8B-Instruct",
|
164 |
description="Upload a video file to analyze using RAG techniques with Meta-Llama-3.1-8B-Instruct."
|
165 |
)
|
|
|
83 |
bigfive_knowledge = load_knowledge("knowledge/bigfive_definitions.txt")
|
84 |
personalities_knowledge = load_knowledge("knowledge/personalities_definitions.txt")
|
85 |
|
86 |
+
# Create vector stores
|
87 |
+
embeddings = HuggingFaceEmbeddings()
|
88 |
+
attachments_db = FAISS.from_texts([attachments_knowledge], embeddings)
|
89 |
+
bigfive_db = FAISS.from_texts([bigfive_knowledge], embeddings)
|
90 |
+
personalities_db = FAISS.from_texts([personalities_knowledge], embeddings)
|
91 |
+
|
92 |
# Lazy initialization for retrieval chains
|
93 |
class LazyChains:
|
94 |
def __init__(self, lazy_llm):
|
|
|
101 |
def get_chains(self):
|
102 |
if self.attachments_chain is None:
|
103 |
llm = self.lazy_llm.get_llm()
|
104 |
+
self.attachments_chain = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=attachments_db.as_retriever())
|
105 |
+
self.bigfive_chain = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=bigfive_db.as_retriever())
|
106 |
+
self.personalities_chain = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=personalities_db.as_retriever())
|
107 |
return self.attachments_chain, self.bigfive_chain, self.personalities_chain
|
108 |
|
109 |
lazy_chains = LazyChains(lazy_llm)
|
|
|
165 |
iface = gr.Interface(
|
166 |
fn=process_video,
|
167 |
inputs=gr.File(label="Upload Video File"),
|
168 |
+
outputs=gr.Textbox(label="Results"),
|
169 |
title="Video Analysis with Meta-Llama-3.1-8B-Instruct",
|
170 |
description="Upload a video file to analyze using RAG techniques with Meta-Llama-3.1-8B-Instruct."
|
171 |
)
|