minor changes
Browse files
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 |
-
|
37 |
-
|
|
|
|
|
|
|
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
|