talk-to-god / app.py
k2s0's picture
Create app.py
e385cd1
raw
history blame
1.2 kB
import os
import json
import openai
import gradio as gr
openai.api_key = os.environ.get("openai_api_key")
def greet(input):
myInput = input
myPrompt = f"The following is a conversation with an AI assistant who responds exactly how Jesus would respond based on the text of the Christian bible and personifies Jesus' talking manner and tone. The assistant is helpful, creative, clever, and very friendly, and cites related passages from the Bible in every answer, followed by a prayer spoken in first person by Jesus. \n\n Human: Hello, who are you? \n\n AI: I am an AI created by OpenAI, who responds exactly how Jesus would respond, and cites passages from the bible relevant to your requests in every response. How can I help you today my child? \n\n Human: {myInput} \n\n AI:"
response = openai.Completion.create(
model="text-davinci-003",
prompt=myPrompt,
temperature=0.7,
max_tokens=3000,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.0
)
raw_response = response['choices'][0]['text']
print(raw_response)
return raw_response
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()