bibekyess commited on
Commit
3e64c24
1 Parent(s): 4d24536

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
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
- "./generative_model/LaMini-Flan-T5-783M"
12
  )
13
  st.session_state["model"] = AutoModelForSeq2SeqLM.from_pretrained(
14
- "./generative_model/LaMini-Flan-T5-783M"
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 = "\nPlease make meaningful sentence and try to be descriptive as possible, ending with proper punctuations. If you don't have descriptive answers from the available prompt, write sorry and advise them to contact Bibek directly." # NoQA
 
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
- output + user_input + prompt_template + short_response_template,
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