cochi1706 commited on
Commit
62a0bb6
·
1 Parent(s): 676f57c

Update default max_tokens value and refactor variable names in response generation for clarity in chatbot application.

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -42,7 +42,7 @@ def respond(
42
  """
43
  # Đặt giá trị mặc định nếu không có
44
  if max_tokens is None:
45
- max_tokens = 100
46
  if temperature is None:
47
  temperature = 0.7
48
  if top_p is None:
@@ -72,13 +72,13 @@ def respond(
72
  )
73
 
74
  # Lấy câu trả lời từ kết quả
75
- câu_trả_lời = generated[0]['generated_text']
76
 
77
  # Loại bỏ prompt ban đầu để chỉ lấy phần response
78
- if prompt in câu_trả_lời:
79
- câu_trả_lời = câu_trả_lời.replace(prompt, "").strip()
80
 
81
- return câu_trả_lời
82
 
83
 
84
  """
 
42
  """
43
  # Đặt giá trị mặc định nếu không có
44
  if max_tokens is None:
45
+ max_tokens = 250
46
  if temperature is None:
47
  temperature = 0.7
48
  if top_p is None:
 
72
  )
73
 
74
  # Lấy câu trả lời từ kết quả
75
+ answer = generated[0]['generated_text']
76
 
77
  # Loại bỏ prompt ban đầu để chỉ lấy phần response
78
+ if prompt in answer:
79
+ answer = answer.replace(prompt, "").strip()
80
 
81
+ return answer
82
 
83
 
84
  """