Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,13 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
conversation_history = ""
|
7 |
|
8 |
# Define the conversation function
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Cache the model pipeline to avoid reloading it on each rerun
|
5 |
+
@st.cache_resource
|
6 |
+
def load_model():
|
7 |
+
return pipeline("text2text-generation", model="facebook/blenderbot-400M-distill")
|
8 |
+
|
9 |
+
# Load the model (cached)
|
10 |
+
pipe = load_model()
|
11 |
conversation_history = ""
|
12 |
|
13 |
# Define the conversation function
|