Update app.py
Browse files
app.py
CHANGED
@@ -8,10 +8,10 @@ from chat import generate_response
|
|
8 |
|
9 |
if "tokenizer" not in st.session_state:
|
10 |
st.session_state["tokenizer"] = AutoTokenizer.from_pretrained(
|
11 |
-
"
|
12 |
)
|
13 |
st.session_state["model"] = AutoModelForSeq2SeqLM.from_pretrained(
|
14 |
-
"
|
15 |
)
|
16 |
|
17 |
st.title("B-Bot : Bibek's Personal Chatbot")
|
@@ -35,12 +35,13 @@ if user_input:
|
|
35 |
tokenizer = st.session_state["tokenizer"]
|
36 |
model = st.session_state["model"]
|
37 |
output = generate_response(user_input)
|
38 |
-
prompt_template = "\
|
|
|
39 |
short_response_template = "\nIf your response is very short like 1 or 2 sentence, add a followup sentence like 'Let me know if there's anything else I can help you with. or If there's anything else I can assist with, please don't hesitate to ask. I mean something similar in polite way." # NoQA
|
40 |
-
|
41 |
start = time.time()
|
42 |
input_ids = tokenizer(
|
43 |
-
|
44 |
return_tensors="pt",
|
45 |
).input_ids
|
46 |
|
|
|
8 |
|
9 |
if "tokenizer" not in st.session_state:
|
10 |
st.session_state["tokenizer"] = AutoTokenizer.from_pretrained(
|
11 |
+
"MBZUAI/LaMini-Flan-T5-248M"
|
12 |
)
|
13 |
st.session_state["model"] = AutoModelForSeq2SeqLM.from_pretrained(
|
14 |
+
"MBZUAI/LaMini-Flan-T5-248M"
|
15 |
)
|
16 |
|
17 |
st.title("B-Bot : Bibek's Personal Chatbot")
|
|
|
35 |
tokenizer = st.session_state["tokenizer"]
|
36 |
model = st.session_state["model"]
|
37 |
output = generate_response(user_input)
|
38 |
+
prompt_template = "\nBased on the above content, try to answer the following question.\n\n"
|
39 |
+
end_prompt = "Please make meaningful sentence and try to be descriptive as possible, ending with proper punctuations. If you think, there is good descriptive answers to the question from the above content, write sorry and advise them to contact Bibek directly.\n" # NoQA"
|
40 |
short_response_template = "\nIf your response is very short like 1 or 2 sentence, add a followup sentence like 'Let me know if there's anything else I can help you with. or If there's anything else I can assist with, please don't hesitate to ask. I mean something similar in polite way." # NoQA
|
41 |
+
input = output + prompt_template + user_input + end_prompt
|
42 |
start = time.time()
|
43 |
input_ids = tokenizer(
|
44 |
+
input,
|
45 |
return_tensors="pt",
|
46 |
).input_ids
|
47 |
|