zss2341 commited on
Commit
118f709
1 Parent(s): fe317da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -13
app.py CHANGED
@@ -1,19 +1,17 @@
1
  import gradio as gr
2
  from revChatGPT.V1 import Chatbot
3
- import os
4
 
5
- email = os.environ.get('email')
6
- password = os.environ.get('password')
7
  access_token = None
8
  session_token = None
9
 
10
- def configure_chatbot():
11
 
12
  config = {}
13
  config.update({"email": email,
14
  "password": password})
15
 
16
-
17
  global chatbot
18
  chatbot = Chatbot(config=config)
19
 
@@ -32,17 +30,26 @@ def chatgpt_clone(inputs, history):
32
  return history, history
33
 
34
  with gr.Blocks() as demo:
35
- gr.Markdown("""<h1><center>这是一个代理,用于实现免翻</center></h1> """)
36
- gr.Markdown("#### 作者不便署名,直接使用就行")
37
- gr.Markdown("#### 用爱发电甚难,不要随便乱谈")
38
-
39
- configure_chatbot()
40
-
41
- gr.Markdown("""<h2>Start Chatting ...</h2>""")
 
 
 
 
 
 
 
 
 
42
  chatbot1 = gr.Chatbot()
43
  message = gr.Textbox(placeholder="Chat here")
44
  state = gr.State()
45
- submit = gr.Button("SEND")
46
  submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot1, state])
47
 
48
  demo.launch(debug = True, share=False)
 
1
  import gradio as gr
2
  from revChatGPT.V1 import Chatbot
 
3
 
4
+ email = None
5
+ password = None
6
  access_token = None
7
  session_token = None
8
 
9
+ def configure_chatbot(email,password):
10
 
11
  config = {}
12
  config.update({"email": email,
13
  "password": password})
14
 
 
15
  global chatbot
16
  chatbot = Chatbot(config=config)
17
 
 
30
  return history, history
31
 
32
  with gr.Blocks() as demo:
33
+ gr.Markdown("""<h2><center>这是一个代理,用于实现免翻</center></h2> """)
34
+ gr.Markdown("""<h2><center>小圈自用即可,能用不必谢我</center></h2> """)
35
+ gr.Markdown("""<h2><center>用爱发电甚难,不要随便乱传</center></h2> """)
36
+
37
+
38
+ gr.Markdown("""<h2>Login to OpenAI</h2>""")
39
+ with gr.Row():
40
+ with gr.Group():
41
+ method = gr.Dropdown(label="输入openai邮箱")
42
+ email = gr.Textbox(placeholder="", label="email")
43
+ password = gr.Textbox(placeholder="", label="password")
44
+ with gr.Row():
45
+ login = gr.Button("输完箱密点此登录")
46
+ login.click(configure_chatbot, inputs=[email,password])
47
+
48
+ gr.Markdown("""<h2>开始聊吧 ...</h2>""")
49
  chatbot1 = gr.Chatbot()
50
  message = gr.Textbox(placeholder="Chat here")
51
  state = gr.State()
52
+ submit = gr.Button("输入完成一定要点击这里发送")
53
  submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot1, state])
54
 
55
  demo.launch(debug = True, share=False)