Spaces:
Runtime error
Runtime error
Upload 11 files
Browse files- 1.jpeg +0 -0
- 2.png +0 -0
- app.py +177 -0
- data/Lesson-29.pdf +0 -0
- db/default__vector_store.json +1 -0
- db/docstore.json +1 -0
- db/graph_store.json +1 -0
- db/image__vector_store.json +1 -0
- db/index_store.json +1 -0
- redfernstech-fd8fe-firebase-adminsdk-g9vcn-0537b4efd6.json +13 -0
- requirements.txt +6 -0
1.jpeg
ADDED
![]() |
2.png
ADDED
![]() |
app.py
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dotenv import load_dotenv
|
2 |
+
import gradio as gr
|
3 |
+
import os
|
4 |
+
from llama_index.core import StorageContext, load_index_from_storage, VectorStoreIndex, SimpleDirectoryReader, ChatPromptTemplate, Settings
|
5 |
+
from llama_index.llms.huggingface import HuggingFaceInferenceAPI
|
6 |
+
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
7 |
+
from sentence_transformers import SentenceTransformer
|
8 |
+
import firebase_admin
|
9 |
+
from firebase_admin import db, credentials
|
10 |
+
import datetime
|
11 |
+
import uuid
|
12 |
+
import random
|
13 |
+
|
14 |
+
def select_random_name():
|
15 |
+
names = ['Clara', 'Lily']
|
16 |
+
return random.choice(names)
|
17 |
+
|
18 |
+
# Example usage
|
19 |
+
# Load environment variables
|
20 |
+
load_dotenv()
|
21 |
+
# authenticate to firebase
|
22 |
+
cred = credentials.Certificate("redfernstech-fd8fe-firebase-adminsdk-g9vcn-0537b4efd6.json")
|
23 |
+
firebase_admin.initialize_app(cred, {"databaseURL": "https://redfernstech-fd8fe-default-rtdb.firebaseio.com/"})
|
24 |
+
# Configure the Llama index settings
|
25 |
+
Settings.llm = HuggingFaceInferenceAPI(
|
26 |
+
model_name="meta-llama/Meta-Llama-3-8B-Instruct",
|
27 |
+
tokenizer_name="meta-llama/Meta-Llama-3-8B-Instruct",
|
28 |
+
context_window=3000,
|
29 |
+
token=os.getenv("HF_TOKEN"),
|
30 |
+
max_new_tokens=512,
|
31 |
+
generate_kwargs={"temperature": 0.1},
|
32 |
+
)
|
33 |
+
Settings.embed_model = HuggingFaceEmbedding(
|
34 |
+
model_name="BAAI/bge-small-en-v1.5"
|
35 |
+
)
|
36 |
+
|
37 |
+
# Define the directory for persistent storage and data
|
38 |
+
PERSIST_DIR = "db"
|
39 |
+
PDF_DIRECTORY = 'data' # Changed to the directory containing PDFs
|
40 |
+
|
41 |
+
# Ensure directories exist
|
42 |
+
os.makedirs(PDF_DIRECTORY, exist_ok=True)
|
43 |
+
os.makedirs(PERSIST_DIR, exist_ok=True)
|
44 |
+
|
45 |
+
# Variable to store current chat conversation
|
46 |
+
current_chat_history = []
|
47 |
+
kkk=select_random_name()
|
48 |
+
def data_ingestion_from_directory():
|
49 |
+
# Use SimpleDirectoryReader on the directory containing the PDF files
|
50 |
+
documents = SimpleDirectoryReader(PDF_DIRECTORY).load_data()
|
51 |
+
storage_context = StorageContext.from_defaults()
|
52 |
+
index = VectorStoreIndex.from_documents(documents)
|
53 |
+
index.storage_context.persist(persist_dir=PERSIST_DIR)
|
54 |
+
|
55 |
+
def handle_query(query):
|
56 |
+
chat_text_qa_msgs = [
|
57 |
+
(
|
58 |
+
"user",
|
59 |
+
"""
|
60 |
+
You are the Lily Ai doctor chatbot. Your goal is to provide accurate, and consicse medical diagnosis based on the patient's problem, constantly compare from given data set and compare from what doctor suggested. don't hesitate to reply 'it is out of scope question' if you cannot fetch the related answer.
|
61 |
+
{context_str}
|
62 |
+
Question:
|
63 |
+
{query_str}
|
64 |
+
"""
|
65 |
+
)
|
66 |
+
]
|
67 |
+
text_qa_template = ChatPromptTemplate.from_messages(chat_text_qa_msgs)
|
68 |
+
|
69 |
+
# Load index from storage
|
70 |
+
storage_context = StorageContext.from_defaults(persist_dir=PERSIST_DIR)
|
71 |
+
index = load_index_from_storage(storage_context)
|
72 |
+
|
73 |
+
# Use chat history to enhance response
|
74 |
+
context_str = ""
|
75 |
+
for past_query, response in reversed(current_chat_history):
|
76 |
+
if past_query.strip():
|
77 |
+
context_str += f"User asked: '{past_query}'\nBot answered: '{response}'\n"
|
78 |
+
|
79 |
+
query_engine = index.as_query_engine(text_qa_template=text_qa_template, context_str=context_str)
|
80 |
+
answer = query_engine.query(query)
|
81 |
+
|
82 |
+
if hasattr(answer, 'response'):
|
83 |
+
response = answer.response
|
84 |
+
elif isinstance(answer, dict) and 'response' in answer:
|
85 |
+
response = answer['response']
|
86 |
+
else:
|
87 |
+
response = "Sorry, I couldn't find an answer."
|
88 |
+
|
89 |
+
# Update current chat history
|
90 |
+
current_chat_history.append((query, response))
|
91 |
+
|
92 |
+
return response
|
93 |
+
|
94 |
+
# Example usage: Process PDF ingestion from directory
|
95 |
+
print("Processing PDF ingestion from directory:", PDF_DIRECTORY)
|
96 |
+
data_ingestion_from_directory()
|
97 |
+
|
98 |
+
# Define the function to handle predictions
|
99 |
+
"""def predict(message,history):
|
100 |
+
response = handle_query(message)
|
101 |
+
return response"""
|
102 |
+
|
103 |
+
def predict(message, history):
|
104 |
+
logo_html = '''
|
105 |
+
<div class="circle-logo">
|
106 |
+
<img src="https://rb.gy/8r06eg" alt="FernAi">
|
107 |
+
</div>
|
108 |
+
'''
|
109 |
+
response = handle_query(message)
|
110 |
+
response_with_logo = f'<div class="response-with-logo">{logo_html}<div class="response-text">{response}</div></div>'
|
111 |
+
return response_with_logo
|
112 |
+
def save_chat_message(session_id, message_data):
|
113 |
+
ref = db.reference(f'/chat_history/{session_id}') # Use the session ID to save chat data
|
114 |
+
ref.push().set(message_data)
|
115 |
+
|
116 |
+
# Define your Gradio chat interface function (replace with your actual logic)
|
117 |
+
def chat_interface(message, history):
|
118 |
+
try:
|
119 |
+
# Generate a unique session ID for this chat session
|
120 |
+
session_id = str(uuid.uuid4())
|
121 |
+
|
122 |
+
# Process the user message and generate a response (your chatbot logic)
|
123 |
+
response = handle_query(message)
|
124 |
+
|
125 |
+
# Capture the message data
|
126 |
+
message_data = {
|
127 |
+
"sender": "user",
|
128 |
+
"message": message,
|
129 |
+
"response": response,
|
130 |
+
"timestamp": datetime.datetime.now().isoformat() # Use a library like datetime
|
131 |
+
}
|
132 |
+
|
133 |
+
# Call the save function to store in Firebase with the generated session ID
|
134 |
+
save_chat_message(session_id, message_data)
|
135 |
+
|
136 |
+
# Return the bot response
|
137 |
+
return response
|
138 |
+
except Exception as e:
|
139 |
+
return str(e)
|
140 |
+
|
141 |
+
# Custom CSS for styling
|
142 |
+
css = '''
|
143 |
+
.circle-logo {
|
144 |
+
display: inline-block;
|
145 |
+
width: 40px;
|
146 |
+
height: 40px;
|
147 |
+
border-radius: 50%;
|
148 |
+
overflow: hidden;
|
149 |
+
margin-right: 10px;
|
150 |
+
vertical-align: middle;
|
151 |
+
}
|
152 |
+
.circle-logo img {
|
153 |
+
width: 100%;
|
154 |
+
height: 100%;
|
155 |
+
object-fit: cover;
|
156 |
+
}
|
157 |
+
.response-with-logo {
|
158 |
+
display: flex;
|
159 |
+
align-items: center;
|
160 |
+
margin-bottom: 10px;
|
161 |
+
}
|
162 |
+
footer {
|
163 |
+
display: none !important;
|
164 |
+
background-color: #F8D7DA;
|
165 |
+
}
|
166 |
+
label.svelte-1b6s6s {display: none}
|
167 |
+
div.svelte-rk35yg {display: none;}
|
168 |
+
div.progress-text.svelte-z7cif2.meta-text {display: none;}
|
169 |
+
|
170 |
+
|
171 |
+
'''
|
172 |
+
|
173 |
+
gr.ChatInterface(chat_interface,
|
174 |
+
css=css,
|
175 |
+
description="Lily",
|
176 |
+
clear_btn=None, undo_btn=None, retry_btn=None,
|
177 |
+
).launch()
|
data/Lesson-29.pdf
ADDED
Binary file (298 kB). View file
|
|
db/default__vector_store.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"embedding_dict": {"860863cb-ba90-4287-9ff3-de812a7cf04a": [-0.04935232177376747, 0.014276032336056232, -0.00677516171708703, -0.007499701343476772, 0.0857427641749382, 0.03596746549010277, -0.06747723370790482, 0.035292088985443115, 0.0009802288841456175, 0.011373339220881462, 0.024754010140895844, -0.03062259964644909, 0.011178512126207352, 0.01658494584262371, -0.025193003937602043, 0.007735987193882465, -0.026199763640761375, -0.004099538084119558, 0.03002157434821129, 0.018483860418200493, 0.008464190177619457, -0.03511177375912666, 0.021300099790096283, 0.045198313891887665, 0.02103796787559986, 0.04658903181552887, -0.03597500920295715, -0.07936180382966995, -0.048395734280347824, -0.23985832929611206, 0.05988171696662903, 0.00787472166121006, 0.06542612612247467, 0.016137035563588142, -0.029961371794342995, 0.016481216996908188, -0.020172743126749992, 0.05845439434051514, 0.029444292187690735, 0.0327472984790802, -0.060793109238147736, -0.021447496488690376, -0.010194200091063976, -0.03895203024148941, 0.002724932273849845, -0.04428384453058243, -0.04992429539561272, -0.020091135054826736, -0.008397594094276428, 0.006678513251245022, -0.04897148534655571, -0.060120902955532074, 0.00495715020224452, 0.031236156821250916, -0.024438021704554558, -0.001887921360321343, 0.08040959388017654, 0.0212861318141222, 0.019926222041249275, 0.041057415306568146, 0.0645257979631424, 0.029546035453677177, -0.13904771208763123, 0.01744740828871727, 0.06266944855451584, 0.041324276477098465, -0.0977046936750412, -0.042026087641716, -0.02397708222270012, 0.000938264187425375, -0.031055675819516182, 0.022282985970377922, 0.039871398359537125, 0.011208692565560341, 0.059094201773405075, 0.01761738955974579, 0.03747517243027687, 0.002703616861253977, 0.015252131968736649, -0.0339764729142189, 0.034126173704862595, 0.05502382293343544, 0.020618971437215805, -0.030696270987391472, -0.013595390133559704, -0.02856854349374771, 0.0403427854180336, -0.02784808911383152, -0.004025080241262913, -0.011623065918684006, -0.023647073656320572, -0.021383848041296005, -0.03101491369307041, 0.05079283565282822, -0.04112066701054573, -0.03585713356733322, -0.02295582741498947, 0.0062613822519779205, 0.02795836143195629, 0.45919111371040344, 0.015642572194337845, 0.010819172486662865, -0.018927421420812607, 0.05333065986633301, -0.013381321914494038, -0.06688794493675232, 0.004536801483482122, -0.02615642547607422, -0.024168578907847404, -0.004391009919345379, 0.02736389823257923, 0.02036883682012558, -0.040253669023513794, -0.03790125250816345, 0.007962658070027828, -0.0071958815678954124, 0.049702417105436325, -0.01769251562654972, -0.007585907820612192, -0.012356655672192574, 0.008346965536475182, -0.025942832231521606, 0.030699746683239937, -0.031913790851831436, 0.05911710113286972, -0.05253056809306145, 0.03923376277089119, 0.08774489164352417, 0.038656190037727356, -0.001138997613452375, 0.027105676010251045, 0.027531057596206665, -0.08285865932703018, 0.01835499331355095, -0.00720310490578413, -0.030862700194120407, -0.0021355219651013613, -0.016528071835637093, 0.007597050163894892, 0.02883450873196125, -0.011319754645228386, 0.03828631341457367, -0.007711352314800024, -0.09212921559810638, -0.12980586290359497, 0.153176948428154, 0.011540068313479424, 0.03229355439543724, -0.036570385098457336, -0.05308893322944641, 0.04680844396352768, 0.07722964882850647, -0.019974086433649063, 0.01124553382396698, 0.03856383636593819, 0.031176432967185974, -0.019309746101498604, -0.023881902918219566, -0.020723534747958183, 0.03380262106657028, -0.018595557659864426, -0.030544748529791832, 0.021867908537387848, 0.10692565888166428, 0.01082476507872343, -0.032912179827690125, -0.007422571070492268, 0.044559549540281296, -0.02630840614438057, 0.006297847256064415, -0.005424784496426582, -0.043432921171188354, 0.018201762810349464, 0.016728423535823822, -0.03545304760336876, 0.036799076944589615, -0.00962867308408022, -0.01837957464158535, -0.005215011071413755, 0.006207386497408152, -0.003111738944426179, -0.014922741800546646, -0.07831963896751404, 0.011641087010502815, 0.03601595386862755, 0.01461033709347248, -0.018093876540660858, -0.01139074470847845, 0.004400675185024738, 0.06439895927906036, 0.043229930102825165, -0.05553846061229706, -0.007091710343956947, 0.03263641893863678, -0.01781558059155941, 0.010551278479397297, -0.010003015398979187, -0.005920502822846174, -0.0057300967164337635, -0.06755722314119339, 0.03704983368515968, 0.0756269097328186, 0.03213987126946449, 0.0392606295645237, -0.02188468724489212, 0.005344125907868147, -0.007023293059319258, 0.006461248733103275, 0.05830821394920349, 0.02524745464324951, -0.06875360757112503, 0.0077574849128723145, -0.008623662404716015, 0.017420368269085884, -0.014371651224792004, 0.01098068617284298, 0.015060738660395145, 0.0575602725148201, -0.015285676345229149, 0.055246952921152115, -0.0046562557108700275, -0.0018068264471367002, -0.017236808314919472, -0.3138227164745331, -0.03679979592561722, 0.025411024689674377, 0.04189690202474594, -0.01532608363777399, -0.0593300499022007, 0.007799589075148106, 0.017681816592812538, 0.004527967423200607, 0.014501117169857025, 0.03831024095416069, 0.0643090233206749, -0.06463051587343216, -0.06307888776063919, -0.018941743299365044, -0.014238502830266953, 0.007583525497466326, -0.017396165058016777, -0.032528795301914215, 0.04459691792726517, 0.016582539305090904, 0.002379573881626129, -0.0007301989244297147, -0.01501720491796732, 0.07269556820392609, -0.03588758409023285, 0.1032787337899208, -0.06350622326135635, 0.006171433720737696, 0.015278211794793606, -0.02456526644527912, 0.03500528261065483, -0.03471928462386131, -0.03898708149790764, 0.023004775866866112, -0.028884489089250565, -0.057739198207855225, -0.0035506936255842447, -0.019762180745601654, -0.039818767458200455, -0.020245185121893883, -0.001681070076301694, 0.03693488612771034, -0.08100935816764832, -0.03178160637617111, -0.030177531763911247, -0.020812533795833588, -0.014491626992821693, -0.01819487474858761, -0.00693318247795105, -0.025987470522522926, 0.0203871913254261, 0.03322084620594978, 0.007113815750926733, 0.01175146084278822, 0.011802028864622116, -0.04891163483262062, 0.03362104669213295, -0.07420346140861511, -0.07266935706138611, 0.00424754386767745, -0.05110837519168854, 0.03763461858034134, -0.0029107211157679558, -0.0017669596709311008, -0.009217919781804085, -0.0223727747797966, -0.02276541478931904, -0.005709769204258919, -0.018832406029105186, -0.018558891490101814, 0.09701454639434814, -3.134470171062276e-05, 0.013778149150311947, 0.025061175227165222, 0.06504049152135849, -0.0010301598813384771, -0.0897194966673851, -0.02937312051653862, -0.010941596701741219, 0.0018644781084731221, 0.05590954050421715, 0.026075152680277824, 0.05139530077576637, -0.010917403735220432, 0.00870157778263092, 0.015995193272829056, 0.006445177365094423, 0.04837393760681152, 0.025667952373623848, -0.008727463893592358, -0.029190072789788246, -0.018183276057243347, -0.0621129646897316, 0.020885098725557327, 0.06874728947877884, -0.23344504833221436, -0.02258511632680893, -0.01419254019856453, 0.10320448130369186, -0.005822952836751938, 0.0024899616837501526, 0.023092474788427353, -0.0038407070096582174, -0.013031963258981705, 0.03569323942065239, -0.049997638911008835, 0.029806140810251236, 0.009199211373925209, -0.058769576251506805, -0.03448537364602089, 0.04246056452393532, 0.07039237767457962, -0.04602818936109543, 0.06294197589159012, 0.004651046358048916, -0.001652638427913189, -0.03949356824159622, 0.12305214256048203, -0.02445746771991253, -0.04061185196042061, -0.0042878249660134315, 0.011829865165054798, -0.019710924476385117, 0.028901495039463043, 0.033081069588661194, -0.010725338943302631, -0.02745557762682438, 0.10162729769945145, 0.05656793341040611, 0.016987605020403862, 0.025119241327047348, 0.004949004389345646, -0.061499010771512985, 0.0024393266066908836, 0.01115493569523096, 0.026186874136328697, -0.03403957560658455, 0.015666430816054344, 0.018578195944428444, 0.054081711918115616, 0.009812631644308567, -0.008632104843854904, -0.08555403351783752, 0.00032727871439419687, 0.013853251934051514, -0.04474908858537674, -0.022167515009641647, -0.008224789053201675, 0.01202460192143917, 0.05611058324575424, 0.009806507267057896, 0.03089478611946106, 0.008607840165495872, -0.023285187780857086, -0.045362312346696854, 0.031830571591854095, -0.02046814002096653, 0.01958327554166317, -0.022897496819496155, -0.02404063194990158]}, "text_id_to_ref_doc_id": {"860863cb-ba90-4287-9ff3-de812a7cf04a": "ac226b84-1585-4759-add3-dc5d0af6ef65"}, "metadata_dict": {"860863cb-ba90-4287-9ff3-de812a7cf04a": {"page_label": "1", "file_name": "saved_pdf.pdf", "file_path": "E:\\llama-index RAG\\data\\saved_pdf.pdf", "file_type": "application/pdf", "file_size": 64903, "creation_date": "2024-04-14", "last_modified_date": "2024-04-17", "_node_type": "TextNode", "document_id": "ac226b84-1585-4759-add3-dc5d0af6ef65", "doc_id": "ac226b84-1585-4759-add3-dc5d0af6ef65", "ref_doc_id": "ac226b84-1585-4759-add3-dc5d0af6ef65"}}}
|
db/docstore.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"docstore/metadata": {"ac226b84-1585-4759-add3-dc5d0af6ef65": {"doc_hash": "2c629fa1f2e1e85f17b7d012739aea7cba30cdd55f935ed2225710942132eabf"}, "860863cb-ba90-4287-9ff3-de812a7cf04a": {"doc_hash": "2c629fa1f2e1e85f17b7d012739aea7cba30cdd55f935ed2225710942132eabf", "ref_doc_id": "ac226b84-1585-4759-add3-dc5d0af6ef65"}}, "docstore/data": {"860863cb-ba90-4287-9ff3-de812a7cf04a": {"__data__": {"id_": "860863cb-ba90-4287-9ff3-de812a7cf04a", "embedding": null, "metadata": {"page_label": "1", "file_name": "saved_pdf.pdf", "file_path": "E:\\llama-index RAG\\data\\saved_pdf.pdf", "file_type": "application/pdf", "file_size": 64903, "creation_date": "2024-04-14", "last_modified_date": "2024-04-17"}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {"1": {"node_id": "ac226b84-1585-4759-add3-dc5d0af6ef65", "node_type": "4", "metadata": {"page_label": "1", "file_name": "saved_pdf.pdf", "file_path": "E:\\llama-index RAG\\data\\saved_pdf.pdf", "file_type": "application/pdf", "file_size": 64903, "creation_date": "2024-04-14", "last_modified_date": "2024-04-17"}, "hash": "2c629fa1f2e1e85f17b7d012739aea7cba30cdd55f935ed2225710942132eabf", "class_name": "RelatedNodeInfo"}}, "text": "3.DataProblem\nThisdocumentoutlinesthespecificinstructionsforpreparingtheprovideddatabaseofhumanvoice\nrecordingsfortrainingamachinelearningmodelcapableofdistinguishingbetweenauthenticand\nsyntheticvoices.\n1.DataExplorationandAnalysis:\n\uf0fc UtilizetoolssuchasMatplotlibandSeabornforin-depthdataanalysisandvisualization.\n\uf0fc Beginwithacomprehensiveexplorationofthedatabase,understandingcharacteristics,and\nassessingthedistributionofauthenticandsyntheticsamples.\n\uf0fc Identifyandaddressimbalancedsamplesinthedataset.\n2.ImbalanceHandling:\n\uf0fc Enhancemodelperformancebyemployingtechniquessuchasoversamplingorundersampling,\ne.g.,usingSMOTEorImblearn.\n3.DataCleaning:\n\uf0fc Addressvariationsinsamplewavlengthbyfindingthemeanoftotalsamplelengths.\n\uf0fc Utilizepaddingtechniquestostandardizeeachsampletothefixedmeanlength.\n\uf0fc Handlemisclassifiedsampleswithinthedataset.\n4.FeatureEngineering:\n\uf0fc ExtractrelevantacousticfeatureslikeMFCCs,spectrograms,andpitchfromaudiorecordings.\n\uf0fc Experimentwithdifferentfeaturesetstoidentifythemostdiscriminativeones.\n\uf0fc Normalizeandstandardizefeaturesforconsistentscaling,facilitatingmodeltraining.\n5.SpeakerEmbeddings:\n\uf0fc Considerincorporatingspeakerembeddingstocaptureindividualcharacteristics,enhancingthe\nmodel'sabilitytogeneralizeacrossdiversevoices.\n\uf0fc Implementsuitablemethodsforextractingspeakerembeddings,suchaspre-trainedmodelsor\ntrainingonthedataset.\n6.DataSplitting:\n\uf0fc Splitthedataintotraining,validation,andtestsets,ensuringastratifiedsplit.\n\uf0fc Evaluatemodelperformanceonthevalidationset,minimizinglossbeforefinaltestingonthe\ntestsamples.\n7.DataAugmentation:\n\uf0fc Applydataaugmentationtechniquestoincreasemodelrobustnessagainstvariationsin\nrecordingconditions.\n\uf0fc Techniquesmayincluderandompitchshifts,time-stretching,orintroducingbackgroundnoise.\n8.QualityControl:\n\uf0fc Conductarigorousqualitycontrolchecktoidentifyandaddressanomaliesoroutliersinthe\ndataset.\n\uf0fc Verifythatdatapreprocessingstepsdonotintroduceartifactsnegativelyaffectingmodel\nperformance.\nOncethedataispreparedfollowingtheseguidelines,thetransitionintothemodeldevelopment\nphasewillfocusonselectinganappropriatearchitecture,trainingthemodel,andfine-tuningitfor\noptimalperformance.", "start_char_idx": 0, "end_char_idx": 2150, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}}, "docstore/ref_doc_info": {"ac226b84-1585-4759-add3-dc5d0af6ef65": {"node_ids": ["860863cb-ba90-4287-9ff3-de812a7cf04a"], "metadata": {"page_label": "1", "file_name": "saved_pdf.pdf", "file_path": "E:\\llama-index RAG\\data\\saved_pdf.pdf", "file_type": "application/pdf", "file_size": 64903, "creation_date": "2024-04-14", "last_modified_date": "2024-04-17"}}}}
|
db/graph_store.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"graph_dict": {}}
|
db/image__vector_store.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"embedding_dict": {}, "text_id_to_ref_doc_id": {}, "metadata_dict": {}}
|
db/index_store.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"index_store/data": {"01282bcc-a355-4256-b245-78ace39871e9": {"__type__": "vector_store", "__data__": "{\"index_id\": \"01282bcc-a355-4256-b245-78ace39871e9\", \"summary\": null, \"nodes_dict\": {\"860863cb-ba90-4287-9ff3-de812a7cf04a\": \"860863cb-ba90-4287-9ff3-de812a7cf04a\"}, \"doc_id_dict\": {}, \"embeddings_dict\": {}}"}}}
|
redfernstech-fd8fe-firebase-adminsdk-g9vcn-0537b4efd6.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"type": "service_account",
|
3 |
+
"project_id": "redfernstech-fd8fe",
|
4 |
+
"private_key_id": "0537b4efd68f2bf186da8a2d7ad46e116cf7128b",
|
5 |
+
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC9xhepGY5asg7X\nWgOt3XO1lRhdLWBkycd14dlEv7kjXdcVvNJW/5hS2dbhm5YaOM09EdiquVh6U8Dw\nw7feVN6qCNZ3VMZCKvhWvWjOMSC02WXf993CsfrXf66SvEWVSe4sL6lls3sT1+dh\nyGdGoL+OghfuQrGYulgZbuV7roEF4iwahOQHpKnJMda+y89jAtwLuWOZUBClC8IU\nQOtQtmXS1IPEdn6gqZUPXDuPDCMlSgBWCN8QJa3VY2ZowfHm2EDASa0356ctEEyd\nrebyDwe5gAzlXDEX8FjjN3khLp65FYI8M8rz8R+cvOGaQJJwclzoXONhVWDgNqCs\niHF0N30FAgMBAAECggEAFGiBseHkMQpgqzXBxd2rVws7eAXBuIUJ6g+e2xRX13RS\nMEMX8bAsqY2bXLQWg9JjoUjSiVBDshVgtI5aWdK8XAJ1oev1eDcrxr7kJExx4nur\nR4Hd5iqtZFBrAy+zt0wgjL2Wv4T6MZZF3/pPv5ouOifxD+KPO8f1DSMjvasfXUpC\nQVrra0STVGDZJsvk5n3K+wMObrtNTjU2O+o0jKEU1adat9hFjHf6rniRBOQLPgcN\nJoeo8ru4MmFuTRBp1JsFIv0v8oRJwUiBilZFberWUs8EBvqiwW3PuCGC21CgNUE4\nkN/6ReXP5ZN4AteChCcTBBnAqyO2EDTvrSm82Vtk3wKBgQDx7mIvK41xD6GceIVI\noy1Gkzlzyqflwu7b89IaAYtoxMGI/FD9zz+6UFvUmZjEqGz/8Ie7/lEiWhxR7vzX\nkEAzx3rpXaNj2+l24H/wQpEwibw1o2rRxlEuWz2J1AoRuXsvFMjitNDyMhL/0Wxd\nW/bJ5cdBf5J9lNvP8U97L7TKOwKBgQDIzz6kJOzN/BU5WVyXdMV7SeuBAUI8tie1\nCxnrYI5SW4nk9mX/uop8RW5MZuqCrmXCEBpzuSKNL2NEKYSiDBOEQD/urrA6225G\n6OCOImcJ/ECd+FJmu4N7goNuQ2u/35rKmv8bTB7JU3bIvY5Naq4z5DJI3ReRbkw2\nLCR1A5khvwKBgC9cub/+SLxfkQXu2jj0KQLuA4tVmzTxyo0o2HLa5o3mJvVIYBqw\nHgu9e5zNTQkC6APa9Neq2/tbpLuti7YvuUHpxXg2Kqx7+uKY5LMGdSIJdN0TVvAm\nYPIwToXTCv2ZUDJRYVpwh49CmlGWkB5eyJuR7kY2UVlgcP/uf97f4gbNAoGAIyOA\nxqBff7v4ysxEU4xvch+BQlXCDXWihR+oLXP785VpD9O+DX3K9ewAXQY1SyDRVaAT\nwORIk4QTTr4lI2YRlDbZ+R5AYEw9g9MEWFrUxP6LIBlv8eImI9q2vPi3RiAOqh1t\nPo2XZYthYccpu4pLaXEpC28EzMIMO/6FcqRqi2kCgYEAu6Cq2r7LySPlDnl2VMbc\n33wDvnG/asNuQKGm4z7KWxdt27EexJ2uTFISozG46EO5wZv2NmJYEAh1tt7pS8AK\nL4IC6v+IkwSr56Dc4B4dH95EhZE7GIRAfM2ksAx5NOcb+pbqN+AjjxMla/CCRJyg\nHJxz3U0ys50mvDMYYLk54pY=\n-----END PRIVATE KEY-----\n",
|
6 |
+
"client_email": "firebase-adminsdk-g9vcn@redfernstech-fd8fe.iam.gserviceaccount.com",
|
7 |
+
"client_id": "115059528686363028957",
|
8 |
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
9 |
+
"token_uri": "https://oauth2.googleapis.com/token",
|
10 |
+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
11 |
+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-g9vcn%40redfernstech-fd8fe.iam.gserviceaccount.com",
|
12 |
+
"universe_domain": "googleapis.com"
|
13 |
+
}
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
python-dotenv
|
3 |
+
llama-index
|
4 |
+
llama-index-embeddings-huggingface
|
5 |
+
llama-index-llms-huggingface
|
6 |
+
firebase-admin
|