xiaolv commited on
Commit
e9954ba
1 Parent(s): c266e5d

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -4,6 +4,12 @@ import asyncio
4
  import os
5
  from EdgeGPT import Chatbot, ConversationStyle
6
 
 
 
 
 
 
 
7
  # read cookie from local file
8
  # with open('./cookies.json', 'r') as f:
9
  # cookies = json.load(f)
@@ -28,8 +34,9 @@ async def get_model_reply(prompt,style,cookies,context=[]):
28
 
29
  with gr.Blocks() as dialog_app:
30
 
 
31
  with gr.Tab("Cookies"):
32
- cookies = gr.Textbox(lines=2, label="输入bing.com中的cookies")
33
  with gr.Tab("New Bing Chat GPT4"):
34
  gr.Markdown("# 连接 new-bing 接口,用的是GPT4的接口")
35
  chatbot = gr.Chatbot()
@@ -39,14 +46,14 @@ with gr.Blocks() as dialog_app:
39
  with gr.Row():
40
  inputs = gr.Textbox(
41
  label="输入问题",
42
- placeholder="Enter text and press enter"
43
  )
44
- style = gr.Dropdown(label="回答倾向", choices=["creative", "balanced", "precise"], multiselect=False,
45
- value="balanced", type="value")
46
 
47
  inputs.submit(get_model_reply, [inputs, style, cookies, state], [chatbot, state])
48
  send = gr.Button("Send")
49
- send.click(get_model_reply, [inputs, style, cookies, state], [chatbot, state])
50
 
51
  # launches the app in a new local port
52
  dialog_app.launch()
 
4
  import os
5
  from EdgeGPT import Chatbot, ConversationStyle
6
 
7
+ """
8
+ 参考资料:
9
+ https://www.bilibili.com/video/BV1KV4y197bX/?spm_id_from=333.1007.tianma.2-2-5.click&vd_source=9dc7baa799a4531df364244d2e87ee01
10
+ https://blog.csdn.net/xmh_free/article/details/127210992
11
+ """
12
+
13
  # read cookie from local file
14
  # with open('./cookies.json', 'r') as f:
15
  # cookies = json.load(f)
 
34
 
35
  with gr.Blocks() as dialog_app:
36
 
37
+
38
  with gr.Tab("Cookies"):
39
+ cookies = gr.Textbox(lines=2, label="输入bing.com中的cookies(JSON格式)")
40
  with gr.Tab("New Bing Chat GPT4"):
41
  gr.Markdown("# 连接 new-bing 接口,用的是GPT4的接口")
42
  chatbot = gr.Chatbot()
 
46
  with gr.Row():
47
  inputs = gr.Textbox(
48
  label="输入问题",
49
+ placeholder="请输入你的文本,确保已经正确填入bing.com中的cookies"
50
  )
51
+ style = gr.Dropdown(label="回答倾向模式选择", choices=["creative", "balanced", "precise"], multiselect=False,
52
+ value="precise", type="value")
53
 
54
  inputs.submit(get_model_reply, [inputs, style, cookies, state], [chatbot, state])
55
  send = gr.Button("Send")
56
+ send.click(get_model_reply, [inputs, style, cookies, state], [chatbot, state],api_name="xiaolvgpt")
57
 
58
  # launches the app in a new local port
59
  dialog_app.launch()