KhantKyaw commited on
Commit
6fd5a3c
·
verified ·
1 Parent(s): bdedfa4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -13,7 +13,7 @@ def generate_response(input_text):
13
 
14
  output_sequences = model.generate(
15
  input_ids=input_ids,
16
- max_length=100,
17
  temperature=1.0,
18
  top_k=50,
19
  top_p=0.95,
@@ -25,10 +25,10 @@ def generate_response(input_text):
25
  response_with_prefix = tokenizer.decode(output_sequences[:, input_ids.shape[-1]:][0], skip_special_tokens=True)
26
  response_start_idx = response_with_prefix.find("answer: ")
27
  if response_start_idx != -1:
28
- # Extract everything after "answer: "
29
  response = response_with_prefix[response_start_idx + len("answer: "):]
30
  else:
31
- # If "answer:" is not found in the response, return the whole response
32
  response = response_with_prefix
33
 
34
  return response
 
13
 
14
  output_sequences = model.generate(
15
  input_ids=input_ids,
16
+ max_length=300,
17
  temperature=1.0,
18
  top_k=50,
19
  top_p=0.95,
 
25
  response_with_prefix = tokenizer.decode(output_sequences[:, input_ids.shape[-1]:][0], skip_special_tokens=True)
26
  response_start_idx = response_with_prefix.find("answer: ")
27
  if response_start_idx != -1:
28
+
29
  response = response_with_prefix[response_start_idx + len("answer: "):]
30
  else:
31
+
32
  response = response_with_prefix
33
 
34
  return response