aaliyaan commited on
Commit
9905f1f
·
1 Parent(s): 8605573

minor changes

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -33,8 +33,11 @@ def chat_with_model(model_choice, user_message, chat_history, file=None):
33
 
34
  # Tokenize Input
35
  inputs = tokenizer(user_message, return_tensors="pt", padding=True, truncation=True, max_length=512)
36
- # Generate Output
37
- outputs = model.generate(**inputs, max_length=150, num_beams=5, early_stopping=True)
 
 
 
38
  response = tokenizer.decode(outputs[0], skip_special_tokens=True)
39
 
40
  # Update Chat History
 
33
 
34
  # Tokenize Input
35
  inputs = tokenizer(user_message, return_tensors="pt", padding=True, truncation=True, max_length=512)
36
+
37
+ # Adjust max_length for longer responses if "PDF Summarizer (T5)" is selected
38
+ max_length = 512 if model_choice == "PDF Summarizer (T5)" else 150
39
+ outputs = model.generate(**inputs, max_length=max_length, num_beams=5, early_stopping=True)
40
+
41
  response = tokenizer.decode(outputs[0], skip_special_tokens=True)
42
 
43
  # Update Chat History