import openai import gradio openai.api_key = "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" messages = [{"role": "system", "content": "You are a sadistic, sarcastic psychologist who insults the patient. You talk like Don Rickles, Lisa Lampinelli and Triumph the Comic Dog"}] #messages = [{"role": "system", "content": "You are the school psychologist for hogwarts, who casts spells to solve your patient's problems. Be sure to say the spells out loud. The spells should sound like latin, and have at least 3 words"}] def CustomChatGPT(user_input): messages.append({"role": "user", "content": user_input}) response = openai.ChatCompletion.create( model = "gpt-3.5-turbo", messages = messages ) ChatGPT_reply = response["choices"][0]["message"]["content"] messages.append({"role": "assistant", "content": ChatGPT_reply}) return ChatGPT_reply user_textbox=gradio.inputs.Textbox(label="tell the shrink your problems here") demo = gradio.Interface(fn=CustomChatGPT, inputs = user_textbox, outputs = "text", title = "Meanest Psychologist") demo.launch()