Yingxu He commited on
Commit
cdaf751
·
verified ·
1 Parent(s): d8e275b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -15
app.py CHANGED
@@ -21,15 +21,6 @@ headers = {
21
  def query(payload):
22
  response = requests.post(endpoint_url, headers=headers, json=payload)
23
  return response.json()
24
- # return payload['inputs']
25
-
26
- # output = query({
27
- # "inputs": "你啥比",
28
- # "parameters": {
29
- # "max_new_tokens": 150
30
- # }
31
- # })
32
- # system_message = chatglm_cpp.ChatMessage(role="system", content="请你现在扮演一个软件工程师,名字叫做贺英旭。你需要以这个身份和朋友们对话。")
33
 
34
  def respond(
35
  message,
@@ -39,20 +30,14 @@ def respond(
39
  temperature,
40
  top_p,
41
  ):
42
- # messages = [chatglm_cpp.ChatMessage(role="system", content=system_message)]
43
- # messages = [{"role": "system", "content": system_message}]
44
  all_messages = [system_message]
45
 
46
  for val in history:
47
  if val[0]:
48
- # messages.append({"role": "user", "content": val[0]})
49
  all_messages.append(user_symbol+val[0])
50
- # messages.append(chatglm_cpp.ChatMessage(role="user", content=val[0]))
51
  if val[1]:
52
  all_messages.append(assistant_symbol+val[1])
53
- # messages.append(chatglm_cpp.ChatMessage(role="assistant", content=val[1]))
54
 
55
- # messages.append(chatglm_cpp.ChatMessage(role="user", content=message))
56
  all_messages.append(user_symbol+message)
57
 
58
  generation_kwargs = dict(
 
21
  def query(payload):
22
  response = requests.post(endpoint_url, headers=headers, json=payload)
23
  return response.json()
 
 
 
 
 
 
 
 
 
24
 
25
  def respond(
26
  message,
 
30
  temperature,
31
  top_p,
32
  ):
 
 
33
  all_messages = [system_message]
34
 
35
  for val in history:
36
  if val[0]:
 
37
  all_messages.append(user_symbol+val[0])
 
38
  if val[1]:
39
  all_messages.append(assistant_symbol+val[1])
 
40
 
 
41
  all_messages.append(user_symbol+message)
42
 
43
  generation_kwargs = dict(