m96tkmok commited on
Commit
175fde6
·
verified ·
1 Parent(s): d210621

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -4,6 +4,7 @@ import os
4
  import logging
5
 
6
  from langchain_ollama import ChatOllama
 
7
 
8
  from langchain_community.document_loaders import PyPDFLoader
9
 
@@ -142,6 +143,9 @@ def main() -> None:
142
  ## from llama3.2:latest to unsloth/Llama-3.2-3B
143
  model = ChatOllama(model="unsloth/Llama-3.2-3B")
144
 
 
 
 
145
  rag_chain = (
146
  {"context": retriever|format_docs, "question": RunnablePassthrough()}
147
  | prompt
@@ -160,10 +164,7 @@ def main() -> None:
160
  if submit and text:
161
  with st.spinner("Generating response..."):
162
  # Ken (12/11/2024): modify start
163
- #response = generate_response(rag_chain, text)
164
- ##retriever = configure_retriever(pdf_loader)
165
- ##chain = create_chain(retriever, prompt, model)
166
- response = inference(rag_chain, text)
167
  # Ken (12/11/2024): modify end
168
  st.session_state['chat_history'].append({"user": text, "ollama": response})
169
  st.write(response)
 
4
  import logging
5
 
6
  from langchain_ollama import ChatOllama
7
+ from langchain_community.llms import Ollama
8
 
9
  from langchain_community.document_loaders import PyPDFLoader
10
 
 
143
  ## from llama3.2:latest to unsloth/Llama-3.2-3B
144
  model = ChatOllama(model="unsloth/Llama-3.2-3B")
145
 
146
+ test_llm = model
147
+ test_llm.invoke("Why is the sky blue?")
148
+
149
  rag_chain = (
150
  {"context": retriever|format_docs, "question": RunnablePassthrough()}
151
  | prompt
 
164
  if submit and text:
165
  with st.spinner("Generating response..."):
166
  # Ken (12/11/2024): modify start
167
+ response = generate_response(rag_chain, text)
 
 
 
168
  # Ken (12/11/2024): modify end
169
  st.session_state['chat_history'].append({"user": text, "ollama": response})
170
  st.write(response)