quan1998 commited on
Commit
3f05231
·
verified ·
1 Parent(s): e66ae77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -14,26 +14,26 @@ client = InferenceClient("Qwen/Qwen2.5-Coder-32B-Instruct")
14
 
15
  client = InferenceClient("Qwen/Qwen2.5-Coder-32B-Instruct")
16
 
17
- def greet(messages):
18
  response = ""
19
- for message in client.chat_completion(
20
- messages,
21
  stream=True,
22
- max_tokens=1024,
23
  temperature=0.7,
24
  top_p=0.95
25
  ):
26
- token = message.choices[0].delta.content
27
  response += token
28
  yield response
29
 
30
  demo = gr.Interface(
31
  fn=greet,
32
  inputs=[
33
- gr.JSON(value=[{"role": "user", "content": "Bạn AI"}])
34
  ],
35
  outputs=[gr.Textbox(label="result", lines=3)],
36
- api_name="chat",
37
  clear_btn=None
38
  )
39
 
 
14
 
15
  client = InferenceClient("Qwen/Qwen2.5-Coder-32B-Instruct")
16
 
17
+ def greet(message):
18
  response = ""
19
+ for token in client.text_generation(
20
+ message,
21
  stream=True,
22
+ max_new_tokens=12,
23
  temperature=0.7,
24
  top_p=0.95
25
  ):
26
+ print(token)
27
  response += token
28
  yield response
29
 
30
  demo = gr.Interface(
31
  fn=greet,
32
  inputs=[
33
+ gr.Textbox(label="message", value="The huggingface_hub library is ")
34
  ],
35
  outputs=[gr.Textbox(label="result", lines=3)],
36
+ api_name="generate",
37
  clear_btn=None
38
  )
39