jzhang533 commited on
Commit
03cc6aa
·
1 Parent(s): 372b193

Signed-off-by: Zhang Jun <jzhang533@gmail.com>

Files changed (2) hide show
  1. README.md +2 -2
  2. app.py +4 -3
README.md CHANGED
@@ -1,10 +1,10 @@
1
  ---
2
- title: ERNIE 4.5 Turbo and ERNIE X1 Turbo
3
  emoji: 💬
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 5.0.1
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
 
1
  ---
2
+ title: ERNIE 4.5 Turbo
3
  emoji: 💬
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 5.26.0
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
app.py CHANGED
@@ -3,15 +3,15 @@ import gradio as gr
3
  from openai import OpenAI
4
 
5
 
6
- title = "EERNIE 4.5 Turbo and ERNIE X1 Turbo : BAIDU's LLM"
7
  description = """
8
  - Official Website: <https://yiyan.baidu.com/> (UI in Chinese)
9
  - API services: [Qianfan Large Model Platform](https://cloud.baidu.com/product-s/qianfan_home) (cloud platform providing LLM services, UI in Chinese)
 
10
  """
11
 
12
 
13
  qianfan_api_key = os.getenv("QIANFAN_TOKEN")
14
- #qianfan_model = "ernie-4.5-8k-preview"
15
  qianfan_model = "ernie-4.5-turbo-32k"
16
 
17
  client = OpenAI(base_url="https://qianfan.baidubce.com/v2", api_key=qianfan_api_key)
@@ -54,7 +54,7 @@ def respond(
54
  demo = gr.ChatInterface(
55
  respond,
56
  additional_inputs=[
57
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
58
  gr.Slider(minimum=2, maximum=12288, value=2048, step=1, label="Max new tokens"),
59
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Temperature"),
60
  gr.Slider(
@@ -67,6 +67,7 @@ demo = gr.ChatInterface(
67
  ],
68
  title=title,
69
  description=description,
 
70
  )
71
 
72
  if __name__ == "__main__":
 
3
  from openai import OpenAI
4
 
5
 
6
+ title = "ERNIE 4.5 Turbo: BAIDU's LLM"
7
  description = """
8
  - Official Website: <https://yiyan.baidu.com/> (UI in Chinese)
9
  - API services: [Qianfan Large Model Platform](https://cloud.baidu.com/product-s/qianfan_home) (cloud platform providing LLM services, UI in Chinese)
10
+ - [ERNIE 4.5 Turbo Demo](https://huggingface.co/spaces/PaddlePaddle/ernie_demo) | [ERNIE X1 Turbo Demo](https://huggingface.co/spaces/PaddlePaddle/ernie_x1_demo)
11
  """
12
 
13
 
14
  qianfan_api_key = os.getenv("QIANFAN_TOKEN")
 
15
  qianfan_model = "ernie-4.5-turbo-32k"
16
 
17
  client = OpenAI(base_url="https://qianfan.baidubce.com/v2", api_key=qianfan_api_key)
 
54
  demo = gr.ChatInterface(
55
  respond,
56
  additional_inputs=[
57
+ gr.Textbox(value="", label="System message"),
58
  gr.Slider(minimum=2, maximum=12288, value=2048, step=1, label="Max new tokens"),
59
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Temperature"),
60
  gr.Slider(
 
67
  ],
68
  title=title,
69
  description=description,
70
+ type='messages',
71
  )
72
 
73
  if __name__ == "__main__":