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 = {}
config.update({"email": email,
"password": password})
global chatbot
chatbot = Chatbot(config=config)
login_method = ['Email/Password']
def ask_bot(prompt):
message = ""
for data in chatbot.ask(prompt):
message = data["message"]
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("""
这是一个代理,用于实现免翻
""")
gr.Markdown("""小圈自用即可,能用不必谢我
""")
gr.Markdown("""用爱发电甚难,不要随便乱传
""")
gr.Markdown("""Login to OpenAI
""")
with gr.Row():
with gr.Group():
method = gr.Dropdown(label="输入openai邮箱")
email = gr.Textbox(placeholder="", label="email")
password = gr.Textbox(placeholder="", label="password")
with gr.Row():
login = gr.Button("输完箱密点此登录")
login.click(configure_chatbot, inputs=[email,password])
gr.Markdown("""开始聊吧 ...
""")
chatbot1 = gr.Chatbot()
message = gr.Textbox(placeholder="Chat here")
state = gr.State()
submit = gr.Button("输入完成一定要点击这里发送")
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot1, state])
demo.launch(debug = True, share=False)