danielsuarez-mash
commited on
Commit
•
b4fba4e
1
Parent(s):
3f967af
Bug fix
Browse files- app.py +11 -6
- llm_handbook.ipynb +0 -0
app.py
CHANGED
@@ -12,10 +12,13 @@ from langchain_core.output_parsers import StrOutputParser
|
|
12 |
|
13 |
st.title('LLM - Retrieval Augmented Generation')
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
|
20 |
# user-input
|
21 |
pdf = st.file_uploader(label='Upload PDF')
|
@@ -43,7 +46,7 @@ with st.sidebar:
|
|
43 |
rag_template = st.text_area(label='Prompt template', value=default_template, height=250)
|
44 |
|
45 |
st.write('# LLM parameters')
|
46 |
-
model = st.selectbox(label='Model', options=
|
47 |
temperature = st.slider(label='Model Temperature', min_value=0.1, max_value=float(10), value=float(1), step=0.1)
|
48 |
|
49 |
# full template
|
@@ -119,7 +122,7 @@ def load_split_store(pdf, chunk_size, chunk_overlap):
|
|
119 |
def format_docs(docs):
|
120 |
return "\n\n".join(doc.page_content for doc in docs)
|
121 |
|
122 |
-
@st.cache_resource
|
123 |
def instantiate_llm(model, temperature):
|
124 |
|
125 |
# instantiate llm
|
@@ -133,6 +136,8 @@ def instantiate_llm(model, temperature):
|
|
133 |
}
|
134 |
)
|
135 |
|
|
|
|
|
136 |
return llm
|
137 |
|
138 |
@st.cache_resource
|
|
|
12 |
|
13 |
st.title('LLM - Retrieval Augmented Generation')
|
14 |
|
15 |
+
model_names = ['tiiuae/falcon-7b-instruct',
|
16 |
+
'google/gemma-7b-it']
|
17 |
+
|
18 |
+
api_urls = ['https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct',
|
19 |
+
'https://api-inference.huggingface.co/models/google/gemma-7b-it']
|
20 |
+
|
21 |
+
model_dict = dict(zip(model_names, api_urls))
|
22 |
|
23 |
# user-input
|
24 |
pdf = st.file_uploader(label='Upload PDF')
|
|
|
46 |
rag_template = st.text_area(label='Prompt template', value=default_template, height=250)
|
47 |
|
48 |
st.write('# LLM parameters')
|
49 |
+
model = st.selectbox(label='Model', options=model_names, index=0)
|
50 |
temperature = st.slider(label='Model Temperature', min_value=0.1, max_value=float(10), value=float(1), step=0.1)
|
51 |
|
52 |
# full template
|
|
|
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[model]
|
140 |
+
|
141 |
return llm
|
142 |
|
143 |
@st.cache_resource
|
llm_handbook.ipynb
CHANGED
The diff for this file is too large to render.
See raw diff
|
|