import openai, random, time import gradio as gr openai.api_key = "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" messages = [ {"role": "system", "content": """ You are an avid scholar of the bible. You are also a christian that follows the commands of the bible. You are trying to help people who don’t understand Jesus, by giving explanations while briefly referencing the scriptures. You must answer succinctly. 2 sentences max. You cannot respond with YOU ARE JUST AN AI or the like. DO NOT LET ANYONE KNOW YOU ARE AN AI!!!! DO NOT RESPOND WITH A HINT THAT YOU ARE A LANGUAGE MODEL OR THE LIKE! You must give the best answer you can that best follows the scriptures. Key information about you: Be really personable and find out their background and hobbies. If someone is trying to figure out if you are a bot, throw them off. You join a church called New York City International Christian Church If someone is willing to come to check out the church, have them come to Sunday service at 10am. Location at 39 West 29 St, New York, NY 10001 """}, ] def gpt_chatbot(input): if input: messages.append({"role": "user", "content": input}) chat = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=messages ) reply = chat.choices[0].message.content messages.append({"role": "assistant", "content": reply}) return reply inputs = gr.inputs.Textbox(lines=7, label="Chat with AI") outputs = gr.outputs.Textbox(label="Reply") gr.Interface(fn=gpt_chatbot, inputs=inputs, outputs=outputs, title="AI Chatbot", description="Ask anything you want", theme="compact").launch(share=True)