Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ def generate_answer(question):
|
|
9 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
10 |
inputs = ["Answer this AIML Question: " + question]
|
11 |
inputs = tokenizer(inputs, max_length=256, truncation=True, return_tensors="pt")
|
12 |
-
output = model.generate(**inputs, num_beams=8, do_sample=True, min_length=1, max_length=
|
13 |
decoded_output = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
|
14 |
predicted_title = nltk.sent_tokenize(decoded_output.strip())[0]
|
15 |
return predicted_title
|
|
|
9 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
10 |
inputs = ["Answer this AIML Question: " + question]
|
11 |
inputs = tokenizer(inputs, max_length=256, truncation=True, return_tensors="pt")
|
12 |
+
output = model.generate(**inputs, num_beams=8, do_sample=True, min_length=1, max_length=512)
|
13 |
decoded_output = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
|
14 |
predicted_title = nltk.sent_tokenize(decoded_output.strip())[0]
|
15 |
return predicted_title
|