Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,10 +16,14 @@ def get_models():
|
|
16 |
model = PeftModel.from_pretrained(model, "NursNurs/T5ForReverseDictionary")
|
17 |
|
18 |
tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-large")
|
|
|
|
|
|
|
19 |
|
20 |
-
st.session_state.model['model'] = model
|
21 |
-
st.session_state.model['tokenizer'] = tokenizer
|
22 |
-
|
|
|
23 |
|
24 |
def return_top_k(sentence, k=10):
|
25 |
|
@@ -73,13 +77,12 @@ if 'counters' not in st.session_state:
|
|
73 |
if 'is_helpful' not in st.session_state:
|
74 |
st.session_state.is_helpful = {'ask':False}
|
75 |
|
76 |
-
if 'model' not in st.session_state:
|
77 |
-
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
st.write("The assistant is loaded and ready to use!")
|
83 |
|
84 |
st.title("You name it!")
|
85 |
|
|
|
16 |
model = PeftModel.from_pretrained(model, "NursNurs/T5ForReverseDictionary")
|
17 |
|
18 |
tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-large")
|
19 |
+
|
20 |
+
st.write("The assistant is loaded and ready to use!")
|
21 |
+
return model, tokenizer
|
22 |
|
23 |
+
# st.session_state.model['model'] = model
|
24 |
+
# st.session_state.model['tokenizer'] = tokenizer
|
25 |
+
|
26 |
+
model, tokenizer = get_models()
|
27 |
|
28 |
def return_top_k(sentence, k=10):
|
29 |
|
|
|
77 |
if 'is_helpful' not in st.session_state:
|
78 |
st.session_state.is_helpful = {'ask':False}
|
79 |
|
80 |
+
# if 'model' not in st.session_state:
|
81 |
+
# st.session_state.model = {'model': False, 'tokenizer': False}
|
82 |
|
83 |
+
# if st.session_state.model['model'] == False:
|
84 |
+
# get_models()
|
85 |
+
# st.write("The assistant is loaded and ready to use!")
|
|
|
86 |
|
87 |
st.title("You name it!")
|
88 |
|