Rafii commited on
Commit
60e1b89
·
1 Parent(s): f95eb02

refactor: simplify model initialization and remove caching

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -4,15 +4,15 @@ from huggingface_hub import login
4
  import os
5
  from langchain.memory import ConversationBufferMemory
6
 
7
- @st.cache_resource
8
- def init_model():
9
- token = os.getenv("HF_TOKEN")
10
- if token:
11
- login(token=token)
12
- return load("Rafii/f1llama")
13
  # return load("mlx-community/Mixtral-8x7B-Instruct-v0.1")
14
-
15
- model, tokenizer = init_model()
16
 
17
  if "memory" not in st.session_state:
18
  st.session_state.memory = ConversationBufferMemory(return_messages=True)
 
4
  import os
5
  from langchain.memory import ConversationBufferMemory
6
 
7
+ # @st.cache_resource
8
+ # def init_model():
9
+ # token = os.getenv("HF_TOKEN")
10
+ # if token:
11
+ # login(token=token)
12
+ # return load("Rafii/f1llama")
13
  # return load("mlx-community/Mixtral-8x7B-Instruct-v0.1")
14
+ token = os.getenv("HF_TOKEN")
15
+ model, tokenizer = load("Rafii/f1llama")
16
 
17
  if "memory" not in st.session_state:
18
  st.session_state.memory = ConversationBufferMemory(return_messages=True)