Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,11 +25,9 @@ os.environ['LANGCHAIN_API_KEY'] = 'lsv2_pt_ce80aac3833643dd893527f566a06bf9_667d
|
|
25 |
|
26 |
@st.cache_resource
|
27 |
def load_model():
|
28 |
-
|
29 |
-
model_name = "distilbert-base-uncased"
|
30 |
-
|
31 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
32 |
-
model =
|
33 |
return model, tokenizer
|
34 |
def load_from_pickle(filename):
|
35 |
with open(filename, "rb") as file:
|
@@ -140,7 +138,7 @@ def run_with_timeout(func, args, timeout):
|
|
140 |
return result[0]
|
141 |
# In your Streamlit app
|
142 |
def generate_response(chain, query, context):
|
143 |
-
timeout_seconds =
|
144 |
result = run_with_timeout(chain.invoke, ({"question": query, "chat_history": st.session_state.messages},), timeout_seconds)
|
145 |
if result is None:
|
146 |
return result
|
|
|
25 |
|
26 |
@st.cache_resource
|
27 |
def load_model():
|
28 |
+
model_name = "bigscience/bloom-560m"
|
|
|
|
|
29 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
30 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
31 |
return model, tokenizer
|
32 |
def load_from_pickle(filename):
|
33 |
with open(filename, "rb") as file:
|
|
|
138 |
return result[0]
|
139 |
# In your Streamlit app
|
140 |
def generate_response(chain, query, context):
|
141 |
+
timeout_seconds = 180
|
142 |
result = run_with_timeout(chain.invoke, ({"question": query, "chat_history": st.session_state.messages},), timeout_seconds)
|
143 |
if result is None:
|
144 |
return result
|