danielsuarez-mash
commited on
Commit
•
8d254df
1
Parent(s):
b4fba4e
Updates
Browse files
app.py
CHANGED
@@ -13,10 +13,10 @@ from langchain_core.output_parsers import StrOutputParser
|
|
13 |
st.title('LLM - Retrieval Augmented Generation')
|
14 |
|
15 |
model_names = ['tiiuae/falcon-7b-instruct',
|
16 |
-
'google/gemma-
|
17 |
|
18 |
api_urls = ['https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct',
|
19 |
-
'https://api-inference.huggingface.co/models/google/gemma-
|
20 |
|
21 |
model_dict = dict(zip(model_names, api_urls))
|
22 |
|
@@ -122,7 +122,7 @@ def load_split_store(pdf, chunk_size, chunk_overlap):
|
|
122 |
def format_docs(docs):
|
123 |
return "\n\n".join(doc.page_content for doc in docs)
|
124 |
|
125 |
-
|
126 |
def instantiate_llm(model, temperature):
|
127 |
|
128 |
# instantiate llm
|
@@ -136,8 +136,8 @@ def instantiate_llm(model, temperature):
|
|
136 |
}
|
137 |
)
|
138 |
|
139 |
-
llm.client.api_url = model_dict[model]
|
140 |
-
|
141 |
return llm
|
142 |
|
143 |
@st.cache_resource
|
|
|
13 |
st.title('LLM - Retrieval Augmented Generation')
|
14 |
|
15 |
model_names = ['tiiuae/falcon-7b-instruct',
|
16 |
+
'google/gemma-2-2b']
|
17 |
|
18 |
api_urls = ['https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct',
|
19 |
+
'https://api-inference.huggingface.co/models/google/gemma-2-2b']
|
20 |
|
21 |
model_dict = dict(zip(model_names, api_urls))
|
22 |
|
|
|
122 |
def format_docs(docs):
|
123 |
return "\n\n".join(doc.page_content for doc in docs)
|
124 |
|
125 |
+
@st.cache_resource
|
126 |
def instantiate_llm(model, temperature):
|
127 |
|
128 |
# instantiate llm
|
|
|
136 |
}
|
137 |
)
|
138 |
|
139 |
+
llm.client.api_url = model_dict[str(model)]
|
140 |
+
|
141 |
return llm
|
142 |
|
143 |
@st.cache_resource
|