MNGames commited on
Commit
41efb19
1 Parent(s): 771fad4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -12,7 +12,9 @@ def generate_questions(email):
12
  """Generates questions based on the input email."""
13
  # Encode the email and prompt together with tokenizer
14
  inputs = tokenizer(email, return_tensors="pt", add_special_tokens=True)
15
- inputs["input_ids"] = [tokenizer.cls_token_id] + inputs["input_ids"] # Add CLS token at the beginning
 
 
16
 
17
  # Generate questions using model
18
  generation = model.generate(
@@ -26,6 +28,7 @@ def generate_questions(email):
26
  return tokenizer.decode(generation[0], skip_special_tokens=True)
27
 
28
 
 
29
  def generate_answers(questions):
30
  """Generates possible answers to the input questions."""
31
  # Encode each question with tokenizer, separated by newline
 
12
  """Generates questions based on the input email."""
13
  # Encode the email and prompt together with tokenizer
14
  inputs = tokenizer(email, return_tensors="pt", add_special_tokens=True)
15
+
16
+ # Convert tensor to list before concatenation
17
+ inputs["input_ids"] = [tokenizer.cls_token_id] + inputs["input_ids"].tolist()
18
 
19
  # Generate questions using model
20
  generation = model.generate(
 
28
  return tokenizer.decode(generation[0], skip_special_tokens=True)
29
 
30
 
31
+
32
  def generate_answers(questions):
33
  """Generates possible answers to the input questions."""
34
  # Encode each question with tokenizer, separated by newline