JaiPatel4717 commited on
Commit
eb56443
1 Parent(s): 03444e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -16,8 +16,9 @@ st.title("Nutrition Chatbot")
16
  user_input = st.text_input("Ask me about nutrition:")
17
 
18
  if user_input:
19
- # Encode the input with attention mask
20
- inputs = tokenizer.encode(user_input, return_tensors="pt", return_attention_mask=True)
 
21
  input_ids = inputs['input_ids']
22
  attention_mask = inputs['attention_mask']
23
 
 
16
  user_input = st.text_input("Ask me about nutrition:")
17
 
18
  if user_input:
19
+ # Use encode_plus to get both input_ids and attention_mask
20
+ inputs = tokenizer.encode_plus(user_input, return_tensors="pt", padding=True, truncation=True)
21
+
22
  input_ids = inputs['input_ids']
23
  attention_mask = inputs['attention_mask']
24