ericwangpq commited on
Commit
113c18f
·
1 Parent(s): 57b64b0

model update 1649

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -9,6 +9,8 @@ import json
9
  API_KEY = os.getenv("PPLX_API_KEY")
10
  client = OpenAI(api_key=API_KEY, base_url="https://api.perplexity.ai")
11
 
 
 
12
  def predict(message, history):
13
  history_openai_format = []
14
  for human, assistant in history:
@@ -16,9 +18,8 @@ def predict(message, history):
16
  history_openai_format.append({"role": "assistant", "content": assistant})
17
  history_openai_format.append({"role": "user", "content": message})
18
 
19
- # 使用 Perplexity AI 的 70B 模型进行响应
20
  response = client.chat.completions.create(
21
- model='pplx-70b-online',
22
  messages=history_openai_format,
23
  temperature=1.0,
24
  stream=True
@@ -39,10 +40,9 @@ with open('disclosure.json') as file:
39
  disclosure_text = json.load(file)
40
 
41
  def change_textbox(choice):
42
- #根据不同输入对输出控件进行更新
43
- if choice == "test1":
44
  return gr.update(lines=2, visible=True, value=disclosure_text.get('text1',''))
45
- elif choice == "test2":
46
  return gr.update(lines=2, visible=True, value=disclosure_text.get('text2',''))
47
  else:
48
  return gr.update(visible=False)
@@ -57,7 +57,7 @@ with gr.Blocks(fill_height=True) as demo:
57
 
58
 
59
  # chat_interface = gr.ChatInterface(predict)
60
- # 启动应用
61
  demo.launch(share=True)
62
 
63
 
 
9
  API_KEY = os.getenv("PPLX_API_KEY")
10
  client = OpenAI(api_key=API_KEY, base_url="https://api.perplexity.ai")
11
 
12
+ GSE_model="llama-3-70b-instruct"
13
+
14
  def predict(message, history):
15
  history_openai_format = []
16
  for human, assistant in history:
 
18
  history_openai_format.append({"role": "assistant", "content": assistant})
19
  history_openai_format.append({"role": "user", "content": message})
20
 
 
21
  response = client.chat.completions.create(
22
+ model=GSE_model,
23
  messages=history_openai_format,
24
  temperature=1.0,
25
  stream=True
 
40
  disclosure_text = json.load(file)
41
 
42
  def change_textbox(choice):
43
+ if choice == "mode1":
 
44
  return gr.update(lines=2, visible=True, value=disclosure_text.get('text1',''))
45
+ elif choice == "mode2":
46
  return gr.update(lines=2, visible=True, value=disclosure_text.get('text2',''))
47
  else:
48
  return gr.update(visible=False)
 
57
 
58
 
59
  # chat_interface = gr.ChatInterface(predict)
60
+
61
  demo.launch(share=True)
62
 
63