quan1998 commited on
Commit
930eab4
·
verified ·
1 Parent(s): 6b81614

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -38,18 +38,9 @@ def respond(
38
  """
39
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
40
 
41
- demo = gr.ChatInterface(
42
- respond,
43
- additional_inputs=[
44
- gr.JSON(value=[{"role": "user", "content": "Bạn là AI"}]),
45
- gr.Checkbox(label="Morning", key="stream")
46
- ]
47
- )
48
-
49
  """
50
 
51
- def greet(message):
52
- messages = [{"role": "user", "content": message}]
53
  response = ""
54
  for message in client.chat_completion(
55
  messages,
@@ -64,8 +55,11 @@ def greet(message):
64
 
65
  demo = gr.Interface(
66
  fn=greet,
67
- inputs=["text"],
68
- outputs=[gr.Textbox(label="greeting", lines=3)],
 
 
 
69
  )
70
 
71
  if __name__ == "__main__":
 
38
  """
39
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
40
 
 
 
 
 
 
 
 
 
41
  """
42
 
43
+ def greet(messages):
 
44
  response = ""
45
  for message in client.chat_completion(
46
  messages,
 
55
 
56
  demo = gr.Interface(
57
  fn=greet,
58
+ inputs=[
59
+ gr.JSON(value=[{"role": "user", "content": "Bạn là AI"}])
60
+ ],
61
+ outputs=[gr.Textbox(label="result", lines=3)],
62
+ api_name="chat"
63
  )
64
 
65
  if __name__ == "__main__":