File size: 1,931 Bytes
fe317da
 
 
118f709
 
fe317da
 
 
ae63d2e
fe317da
1e49bd2
 
b819abd
fe317da
 
 
 
 
 
 
ffb8974
bf3a1d2
fe317da
 
 
 
 
 
 
 
 
ffeda60
d1b5f68
ffeda60
 
3454750
d1b5f68
 
 
 
 
 
 
8c4364d
ffeda60
ae63d2e
d1b5f68
ae63d2e
3a938b9
ae63d2e
fcd34b2
c943d64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import gradio as gr
from revChatGPT.V1 import Chatbot

email = None
password = None
access_token = None
session_token = None

def configure_chatbot(email, password):
    config = {}
    if password:  
        config.update({"email": email,
                      "password": password})

    global chatbot
    chatbot = Chatbot(config=config)

def ask_bot(prompt):
    message = ""
    for data in chatbot.ask(prompt):
        message = data["message"]
#        message = message.replace("\n", "<br>")
    return message

def chatgpt_clone(inputs, history):
    history = history or []
    output = ask_bot(inputs)
    history.append((inputs, output))
    return history, history

with gr.Blocks() as demo:
    gr.Markdown("""<h3><center>一个代理,免验免翻</center></h3> """)
    gr.Markdown("""<h3><center>用爱发电,兴趣使然</center></h3> """)
    gr.Markdown("""<h3><center>自用即可,能力有限</center></h3> """)
    gr.Markdown("""<h3><center>网址常变,来去随缘</center></h3> """)
    gr.Markdown("""<h3><center>本站不稳定,请关注wx:GLASOO以获得反馈和更新</center></h3> """)
    
    with gr.Row():
        with gr.Column():
            email = gr.Textbox(label="输入openAI的邮箱地址")
            password = gr.Textbox(label="输入openAI的登录密码", type="password")
            login = gr.Button("输完箱密点此登录,点了即可,没做反馈")
            login.click(configure_chatbot, inputs=[email, password])
              
    gr.Markdown("""<h3>点完登录就开始聊吧 ...</h3>""")
    chatbot1 = gr.Chatbot()
    message = gr.Textbox(placeholder="点这个框输入聊天内容,换行用shift enter", label="人类:", max_lines=10)
    state = gr.State()
    submit = gr.Button("输入后点击这里发送")
    submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot1, state])

    demo.launch(debug = False, share=False)